Round 1
Questions:
Question 1:
public static int findNumOfPairs(List<Integer> a, List<Integer> b) { PriorityQueue<Integer> pq1 = new PriorityQueue<>(Collections.reverseOrder()); PriorityQueue<Integer> pq2 = new PriorityQueue<>(Collections.reverseOrder()); for(Integer i: a) pq1.offer(i); for(Integer i: b) pq2.offer(i); int c = 0; for(int i = 0; i < a.size(); i++) { if(pq1.peek().compareTo(pq2.peek()) == 1) { c++; pq1.poll(); pq2.poll(); } else { if(pq2.size() == 0) break; pq2.poll(); } } return c; }
Question 2:
public static String rplForm(char[] w, int s, String substr) { for(int i = 0; i < substr.length(); i++) { if(w[s + i] == '?') { w[s + i] = substr.charAt(i); } else if(w[s + i] != substr.charAt(i)) return null; } for(int i = 0; i < w.length; i++) { if(w[i] == '?') { w[i] = 'a'; } } return new String(w); } public static String getSmallestString(String word, String substr) { String smlRes = null; for(int i = 0; i <= word.length() - substr.length(); i++) { boolean canPlaceSubstr = true; for(int j = 0; j < substr.length(); j++) { if(word.charAt(i + j) != '?' && word.charAt(i + j) != substr.charAt(j)) { canPlaceSubstr = false; break; } } if(canPlaceSubstr) { char[] w = word.toCharArray(); String r = rplForm(w, i, substr); if(r != null) { if(smlRes == null || r.compareTo(smlRes) < 0) smlRes = r; } } } return smlRes != null ? smlRes : "-1"; }
Candidate's Approach
No approach provided.
Interviewer's Feedback
No feedback provided.
#### Other Experiences - Microsoft OA: [Link](https://leetcode.com/discuss/interview-question/5322819/microsoft-online-assessment-sde-2/2462401) - Arcesium OA: [Link](https://leetcode.com/discuss/interview-question/5417760/Arcesium-or-OA) - Salesforce OA: [Link](https://leetcode.com/discuss/interview-question/5417655/Salesforce-or-MTS-or-OA) - Google Interview Experience: [Link](https://leetcode.com/discuss/interview-experience/5484676/Google-or-Interview-Experience-or-SDE-2-or-On-going) - ServiceNow Interview Experience: [Link](https://leetcode.com/discuss/interview-experience/5613333/ServiceNow-or-Software-Engineer-IC3-or-Hyderabad-or-July-2024) - Microsoft Interview Experience: [Link](https://leetcode.com/discuss/interview-experience/5605141/Microsoft-or-SDE-2) - Zepto Interview Experience: [Link](https://leetcode.com/discuss/interview-experience/5770885/Zepto-or-SDE-2-or-Gurgaon) - Goldmann OA: [Link](https://leetcode.com/discuss/interview-experience/5771853/Goldmann-or-SDE) LLD | Full Working Code: - TicTacToe: [Link](https://leetcode.com/discuss/interview-question/5603649/Tic-Tac-Toe-or-Full-Working-Code-or-LLD)