Example 2:
Input: “(()())(())(()(()))”
Output: “()()()()(())”
Explanation:
The input string is “(()())(())(()(()))”, with primitive decomposition “(()())” + “(())” + “(()(()))”.
After removing outer parentheses of each part, this is “()()” + “()” + “()(())” = “()()()()(())”.
Example 3:
Input: “()()”
Output: “”
Explanation:
The input string is “()()”, with primitive decomposition “()” + “()”.
After removing outer parentheses of each part, this is “” + “” = “”.
Note:
-
S.length <= 10000
-
S[i] is “(” or “)”
-
S is a valid parentheses string
[Answer]
Runtime: 2 ms, faster than 98.06% of Java online submissions for Remove Outermost Parentheses.
Memory Usage: 37.9 MB, less than 28.12% of Java online submissions for Remove Outermost Parentheses.
class Solution {
public String removeOuterParentheses(String S) {
StringBuilder sb = new StringBuilder();
int numL = 0, numR = 0;
for (char c : S.toCharArray()) {
if (c == ‘(’) {
numL++;
if (numL != 1)
sb.append©;
} else {
numR++;
if (numL == numR) {
numL = 0;
numR = 0;
} else {
sb.append©;
}
}
}
return sb.toString();
}
}
Runtime: 19 ms, faster than 16.37% of Java online submissions for Remove Outermost Parentheses.
Memory Usage: 37 MB, less than 94.16% of Java online submissions for Remove Outermost Parentheses.
class Solution {
public String removeOuterParentheses(String S) {
String result = “”;
int open = 0;
for (char c : S.toCharArray()) {
if (c == ‘(’) {
if (open > 0) {
result += “(”;
}
open++;
} else {
if (open > 1) {
result += “)”;
}
open–;
}
}
return result;
}
}
1051. Height Checker
[Description]
Students are asked to stand in non-decreasing order of heights for an annual photo.
Return the minimum number of students not standing in the right positions. (This is the number of students that must move in order for all students to be standing in non-decreasing order of height.)
Example 1:
Input: [1,1,4,2,1,3]
Output: 3
Explanation: Students with heights 4, 3 and the last 1 are not standing in the right positions.
Note:
1 <= heights.length <= 100
自我介绍一下,小编13年上海交大毕业,曾经在小公司待过,也去过华为、OPPO等大厂,18年进入阿里一直到现在。
深知大多数Android工程师,想要提升技能,往往是自己摸索成长或者是报班学习,但对于培训机构动则几千的学费,着实压力不小。自己不成体系的自学效果低效又漫长,而且极易碰到天花板技术停滞不前!
因此收集整理了一份《2024年Android移动开发全套学习资料》,初衷也很简单,就是希望能够帮助到想自学提升又不知道该从何学起的朋友,同时减轻大家的负担。
既有适合小白学习的零基础资料,也有适合3年以上经验的小伙伴深入学习提升的进阶课程,基本涵盖了95%以上Android开发知识点,真正体系化!
由于文件比较大,这里只是将部分目录大纲截图出来,每个节点里面都包含大厂面经、学习笔记、源码讲义、实战项目、讲解视频,并且后续会持续更新
如果你觉得这些内容对你有帮助,可以添加V:vip204888 备注Android获取(资料价值较高,非无偿)
总结:
面试是一个不断学习、不断自我提升的过程,有机会还是出去面面,至少能想到查漏补缺效果,而且有些知识点,可能你自以为知道,但让你说,并不一定能说得很好。
有些东西有压力才有动力,而学到的知识点,都是钱(因为技术人员大部分情况是根据你的能力来定级、来发薪水的),技多不压身。
附上我的面试各大专题整理: 面试指南,满满的都是干货,希望对大家有帮助!
的过程,有机会还是出去面面,至少能想到查漏补缺效果,而且有些知识点,可能你自以为知道,但让你说,并不一定能说得很好。
有些东西有压力才有动力,而学到的知识点,都是钱(因为技术人员大部分情况是根据你的能力来定级、来发薪水的),技多不压身。
附上我的面试各大专题整理: 面试指南,满满的都是干货,希望对大家有帮助!
[外链图片转存中…(img-gUk8iSPM-1711572504211)]