摘要: 题目 You are given an n x n 2D matrix representing an image. Rotate the image by 90 degrees (clockwise). 思路: 1、传统思路:将行和列互换,但是前期行换列的过程会影响到后期的行换列,所以要额外使用一 阅读全文
posted @ 2016-04-12 19:50 wangb021 阅读(128) 评论(0) 推荐(0) 编辑
摘要: 题目: Rotate an array of n elements to the right by k steps. For example, with n = 7 and k = 3, the array [1,2,3,4,5,6,7] is rotated to [5,6,7,1,2,3,4]. 阅读全文
posted @ 2016-04-12 19:19 wangb021 阅读(160) 评论(0) 推荐(0) 编辑
摘要: Given an array and a value, remove all instances of that value in place and return the new length. Do not allocate extra space for another array, you 阅读全文
posted @ 2016-04-12 19:11 wangb021 阅读(146) 评论(0) 推荐(0) 编辑