From ba072a24034ce014bf08a4dd4e83db343b0e269e Mon Sep 17 00:00:00 2001 From: Allen Liu Date: Sat, 1 Nov 2014 20:35:23 +0800 Subject: [PATCH] update --- Python/{rotateImage.py => rotate-image.py} | 10 +++++----- README.md | 4 +++- 2 files changed, 8 insertions(+), 6 deletions(-) rename Python/{rotateImage.py => rotate-image.py} (90%) diff --git a/Python/rotateImage.py b/Python/rotate-image.py similarity index 90% rename from Python/rotateImage.py rename to Python/rotate-image.py index 6635992ab..c434dffa5 100644 --- a/Python/rotateImage.py +++ b/Python/rotate-image.py @@ -1,4 +1,4 @@ -# Time: O(n ^ 2) +# Time: O(n^2) # Space: O(1) # # You are given an n x n 2D matrix representing an image. @@ -9,7 +9,7 @@ # Could you do this in-place? # -# Time: O(n ^ 2) +# Time: O(n^2) # Space: O(1) class Solution: # @param matrix, a list of lists of integers @@ -29,8 +29,8 @@ def rotate(self, matrix): return matrix -# Time: O(n ^ 2) -# Space: O(n ^ 2) +# Time: O(n^2) +# Space: O(n^2) class Solution2: # @param matrix, a list of lists of integers # @return a list of lists of integers @@ -39,4 +39,4 @@ def rotate(self, matrix): if __name__ == "__main__": matrix = [[1, 2, 3], [4, 5, 6], [7, 8, 9]] - print Solution().rotate(matrix) \ No newline at end of file + print Solution().rotate(matrix) diff --git a/README.md b/README.md index a1255c218..4fdb8ffc2 100644 --- a/README.md +++ b/README.md @@ -56,6 +56,7 @@ Problem | Solution | Time | Space | Difficul [Remove Duplicates from Sorted Array]| [remove-duplicates-from-sorted-array.py] | _O(n)_ | _O(1)_ | Easy | [Remove Duplicates from Sorted Array II]| [remove-duplicates-from-sorted-array-ii.py] | _O(n)_ | _O(1)_ | Medium | [Remove Element] | [remove-element.py] | _O(n)_ | _O(1)_ | Easy | +[Rotate Image] | [rotate-image.py] | _O(n^2)_ | _O(1)_ | Medium | [3 Sum]: https://oj.leetcode.com/problems/3sum/ [3sum.py]:https://github.com/kamyu104/LeetCode/blob/master/Python/3sum.py @@ -83,7 +84,8 @@ Problem | Solution | Time | Space | Difficul [remove-duplicates-from-sorted-array-ii.py]:https://github.com/kamyu104/LeetCode/blob/master/Python/remove-duplicates-from-sorted-array-ii.py [Remove Element]:https://oj.leetcode.com/problems/remove-element/ [remove-element.py]:https://github.com/kamyu104/LeetCode/blob/master/Python/remove-element.py - +[Rotate Image]:https://oj.leetcode.com/problems/rotate-image/ +[rotate-image.py]:https://github.com/kamyu104/LeetCode/blob/master/Python/rotate-image.py ---