摘要:
1824. 最少侧跳次数 题解 dp 数组: dp[i] 表示 到 第i条赛道的最小侧跳次数 class Solution { public int minSideJumps(int[] obstacles) { int INF = (int) 0x3f3f3f3f; int len = obsta 阅读全文
摘要:
2287. 重排字符形成目标字符串 class Solution { public int rearrangeCharacters(String s, String target) { int[] cnt = new int[30]; for (char c : s.toCharArray()) { 阅读全文
摘要:
2185. 统计包含给定前缀的字符串 class Solution { public int prefixCount(String[] words, String pref) { int res = 0; for (String word : words) { if (isEqual(word, p 阅读全文
摘要:
1802. 有界数组中指定下标处的最大值 class Solution { public int maxValue(int n, int index, int maxSum) { int l = 1, r = (int) 1e9; while (l < r) { int mid = (l + r + 阅读全文
摘要:
2042. 检查句子中的数字是否递增 class Solution { public boolean areNumbersAscending(String s) { char[] ch = s.toCharArray(); int pre = -1; for (int i = 0; i < ch.l 阅读全文
摘要:
2351. 第一个出现两次的字母 class Solution { public char repeatedCharacter(String s) { char[] chars = s.toCharArray(); int[] f = new int[30]; for (int i = 0; i < 阅读全文