Implemented 2D matrix and search in sorted Array#2483
Conversation
Search inside a Rotated Sorted Array (search-in-rotated-sorted-array.java)Your solution is correct and efficient. It meets the problem requirements of O(log n) time and O(1) space. The code is clean and easy to read. Well done! One minor point: in the condition You might consider adding comments within the code to explain the two cases (left sorted and right sorted) to make it more understandable for others. For example: This would enhance readability. Overall, great job! VERDICT: PASS Search Inside a Sorted Array whose Length is unknown (2dMatrix.java)It seems there might be a confusion in the problem you are solving. The problem you are addressing is "Search a 2D Matrix", but the problem you were supposed to solve is "Search in a Sorted Array of Unknown Size". The latter requires using an ArrayReader interface, which is not present in your code. For the correct problem, you need to:
Your current solution is correct for the 2D matrix problem, but it does not solve the problem intended here. Please review the problem statement again and implement the solution accordingly. VERDICT: NEEDS_IMPROVEMENT Search a 2D MatrixYour solution is well-implemented and efficient. You correctly applied binary search by converting the 2D indices into 1D indices. Here are a few suggestions for improvement:
Overall, great job! Your code is concise and meets all the problem requirements. VERDICT: PASS |
No description provided.