摘要:
You are given annxn2D matrix representing an image.Rotate the image by 90 degrees (clockwise).Follow up:Could you do this in-place?题目要就地算法,那么可以通过折叠矩阵上... 阅读全文
摘要:
Write an efficient algorithm that searches for a value in anmxnmatrix. This matrix has the following properties:Integers in each row are sorted from l... 阅读全文
摘要:
Given a sorted array of integers, find the starting and ending position of a given target value.Your algorithm's runtime complexity must be in the ord... 阅读全文
摘要:
Given amxnmatrix, if an element is 0, set its entire row and column to 0. Do it in place.这题要注意的就是应该是就地执行,所以可以先采取一个数组将所有0元素的位置记下来,然后一次性的全部置成0即可: 1 clas... 阅读全文
摘要:
Given an array of sizen, find the majority element. The majority element is the element that appears more than⌊ n/2 ⌋times.You may assume that the arr... 阅读全文
摘要:
Given two sorted integer arraysnums1andnums2, mergenums2intonums1as one sorted array.Note:You may assume thatnums1has enough space (size that is great... 阅读全文