Skip to content

Leetcode 48 Rotate Image

This is an interesting problem which looks complex but essentially there are just 2 steps we need to do this. Solution Javascript: Time Complexity:O(n^2) since we visited all the cells in the matrix Space Complexity:O(1) since it’s in place

Leetcode 54 Spiral Matrix

This is indeed a very interesting problem. If we simulate the process, there are a couple of key points to notice: Solution Javascript: Time Complexity:O(m*n) since we visited all the cells in the matrix Space Complexity:O(1)

Leetcode 167 Two Sum II – Input Array Is Sorted

Problem Statement Given a 1-indexed array of integers numbers that is already sorted in non-decreasing order, find two numbers such that they add up to a specific target number. Let these two numbers be numbers[index1] and numbers[index2] where 1 <= index1 < index2 <= numbers.length. Return the indices of the two numbers, index1 and index2, added by… Read More »Leetcode 167 Two Sum II – Input Array Is Sorted