Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
kamyu104 committed Nov 1, 2014
1 parent 80bc668 commit ba072a2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
10 changes: 5 additions & 5 deletions Python/rotateImage.py → Python/rotate-image.py
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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)
print Solution().rotate(matrix)
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

---

Expand Down

0 comments on commit ba072a2

Please sign in to comment.