https://leetcode.cn/problems/faulty-keyboard/
class Solution {
public String finalString(String s) {
int n = s.length();
StringBuilder res = new StringBuilder();
for (int i = 0; i < n; i ++) {
if (s.charAt(i) != 'i') {
res.append(s.charAt(i));
} else {
res.reverse();
}
}
return res.toString();
}
}
https://leetcode.cn/problems/check-if-it-is-possible-to-split-array/description/
class Solution {
public boolean canSplitArray(List<Integer> nums, int m) {
int n = nums.size();
if (n <= 2) return true;
for (int i = 1; i < n ; i ++) {
if (nums.get(i) + nums.get(i - 1) >= m ) return true;;
}
return false;
}
}
https://leetcode.cn/problems/find-the-safest-path-in-a-grid/
https://leetcode.cn/problems/maximum-elegance-of-a-k-length-subsequence/