MSMohd Shakeelingenaral-programming.hashnode.dev003644. Maximum K to Sort a PermutationAug 14, 2025 · 1 min read · class Solution { public int sortPermutation(int[] nums) { int n = nums.length; int max = 1; while(max < n){ max<<=1; } max-=1; int k = max; for(int i=0; i<n; i++){ if...Join discussion
MSMohd Shakeelingenaral-programming.hashnode.dev00228. Summary RangesAug 14, 2025 · 1 min read · class Solution { public List<String> summaryRanges(int[] nums) { List<String> result = new ArrayList<>(); if(nums.length == 0){ return result; } for(int i=0; i<nums.length; i++){ int start ...Join discussion
MSMohd Shakeelinsearchinsert.hashnode.dev001021. Remove Outermost ParenthesesAug 7, 2025 · 1 min read · class Solution { public String removeOuterParentheses(String s) { StringBuilder result = new StringBuilder(); int depth = 0; for (char c : s.toCharArray()) { if (c == '(') { if (depth > 0) { ...Join discussion
MSMohd Shakeelinsearchinsert.hashnode.dev001021. remove-outermost-parenthesesAug 7, 2025 · 1 min read · class Solution { public String removeOuterParentheses(String s) { StringBuilder result = new StringBuilder(); int depth = 0; for (char c : s.toCharArray()) { if (c == '(') { if (depth > 0) { ...Join discussion
MSMohd Shakeelinsearchinsert.hashnode.dev0084. Largest Rectangle in HistogramAug 7, 2025 · 1 min read · class Solution { public int largestRectangleArea(int[] heights) { Stack<Integer> st = new Stack<>(); int res = 0; for(int i=0; i<heights.length; i++){ while(!st.isEmpty() && heights[st.peek()] >= heights[i]){ ...Join discussion