Solve Search in Sorted Matrix using Lua to enhance your skills with lua coding practice , master coding concepts, and prepare for interviews with practical exercises and detailed solutions.
Difficulty : Medium
Categories :
Given a 2D matrix of integers where each row is sorted in ascending order and the first element of each row is greater than the last element of the previous row, implement a function to search for a target value. Return [row, col] if found, or [-1, -1] if not found.
Input: matrix = [ [1,3,5,7], [10,11,16,20], [23,30,34,60] ] target = 3 Output: [0,1] Explanation: Target 3 found at row 0, column 1
Input: matrix = [ [1,3,5], [7,9,11] ] target = 4 Output: [-1,-1] Explanation: Target 4 not found
Real-World Applications Solve problems inspired by Lua's common use cases, such as game development and embedded systems.
Step-by-Step Guidance Break down Lua's concepts into digestible lessons.
Practical Skills Build hands-on experience with Lua for real-world projects.