Competative Coding 3#1183
Conversation
Interview Problem : Pascal's Triangle (PascalTraingle.java)Your solution is correct and efficient. You've correctly identified the time and space complexity. The code is well-structured and follows good practices with clear comments explaining the approach. One minor improvement: instead of using VERDICT: PASS Interview Problem: Pairs with K difference (SumofK.java)Your solution is well-written and efficient. You correctly identified the use of a frequency map to count unique pairs. The code is clean and well-commented. However, there is one minor improvement: you can avoid using the variable "value" in the loop when k != 0, since it is only used for k=0. You can restructure the loop to only use the frequency for k=0. For example: if (k == 0) { This is exactly what you did. So it's fine. Another point: your solution is actually more efficient than the reference solution in terms of space because you don't store the pairs but only count them. The reference solution uses a set of vectors which might be less efficient. Overall, great job! VERDICT: PASS |
No description provided.