Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit db47535

Browse files
go: 122,217,234,237,268,48
1 parent dade468 commit db47535

File tree

10 files changed

+315
-8
lines changed

10 files changed

+315
-8
lines changed

‎README.md‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -890,7 +890,7 @@ You can also ask for problem solving ideas and discuss in GitHub issues directly
890890
|28|[Implement strStr()](https://leetcode.com/problems/implement-strstr/description/)|[Java](https://github.com/guobinhit/myleetcode/blob/master/codes/java/leetcodes/src/main/java/com/hit/basmath/learn/array_and_string/_28.java) & Python|Easy| Strings
891891
|36|[Valid Sudoku](https://leetcode.com/problems/valid-sudoku/description/)|[Java](https://github.com/guobinhit/myleetcode/blob/master/codes/java/leetcodes/src/main/java/com/hit/basmath/learn/hash_table/_36.java) & Python |Medium| Array
892892
|38|[Count and Say](https://leetcode.com/problems/count-and-say/description/)|[Java](https://github.com/guobinhit/myleetcode/blob/master/codes/java/leetcodes/src/main/java/com/hit/basmath/interview/top_interview_questions/easy_collection/strings/_38.java) & Python |Easy| Strings
893-
|48|[Rotate Image](https://leetcode.com/problems/rotate-image/description/)|[Java](https://github.com/guobinhit/myleetcode/blob/master/codes/java/leetcodes/src/main/java/com/hit/basmath/interview/top_interview_questions/easy_collection/array/_48.java) & Python |Medium| Array
893+
|48|[Rotate Image](https://leetcode.com/problems/rotate-image/description/)|[Java](https://github.com/guobinhit/myleetcode/blob/master/codes/java/leetcodes/src/main/java/com/hit/basmath/interview/top_interview_questions/easy_collection/array/_48.java) & [Go](../master/codes/go/leetcodes/interview/easy_collection/48.go) |Medium| Array
894894
|53|[Maximum Subarray](https://leetcode.com/problems/maximum-subarray/description/)|[Java](https://github.com/guobinhit/myleetcode/blob/master/codes/java/leetcodes/src/main/java/com/hit/basmath/interview/top_interview_questions/easy_collection/dynamic_programming/_53.java) & [Python](https://github.com/guobinhit/myleetcode/blob/master/codes/python/leetcodes/src/main/python/com/hit/basmath/interview/top_interview_questions/easy_collection/dynamic_programming/_53.py) |Easy| Dynamic Programming
895895
|66|[Plus One](https://leetcode.com/problems/plus-one/description/)|[Java](https://github.com/guobinhit/myleetcode/blob/master/codes/java/leetcodes/src/main/java/com/hit/basmath/learn/array_and_string/_66.java) & [Go](../master/codes/go/leetcodes/interview/easy_collection/66.go)|Easy| Array
896896
|70|[Climbing Stairs](https://leetcode.com/problems/climbing-stairs/description/)|[Java](https://github.com/guobinhit/myleetcode/blob/master/codes/java/leetcodes/src/main/java/com/hit/basmath/learn/array_and_string/_70.java) & Python| Easy| Dynamic Programming
@@ -902,7 +902,7 @@ You can also ask for problem solving ideas and discuss in GitHub issues directly
902902
|108|[Convert Sorted Array to Binary Search Tree](https://leetcode.com/problems/convert-sorted-array-to-binary-search-tree/description/)|[Java](https://github.com/guobinhit/myleetcode/blob/master/codes/java/leetcodes/src/main/java/com/hit/basmath/learn/binary_search_tree/_108.java) & Python |Easy| Trees
903903
|118|[Pascal's Triangle](https://leetcode.com/problems/pascals-triangle/description/)|[Java](https://github.com/guobinhit/myleetcode/blob/master/codes/java/leetcodes/src/main/java/com/hit/basmath/learn/array_and_string/_118.java) & [Go](../master/codes/go/leetcodes/interview/easy_collection/7.go)| Easy| Others
904904
|121|[Best Time to Buy and Sell Stock](https://leetcode.com/problems/best-time-to-buy-and-sell-stock/description/)|[Java](https://github.com/guobinhit/myleetcode/blob/master/codes/java/leetcodes/src/main/java/com/hit/basmath/interview/top_interview_questions/easy_collection/dynamic_programming/_121.java) & [Go](../master/codes/go/leetcodes/interview/easy_collection/121.go) |Easy| Dynamic Programming
905-
|122|[Best Time to Buy and Sell Stock II](https://leetcode.com/problems/best-time-to-buy-and-sell-stock-ii)|[Java](https://github.com/guobinhit/myleetcode/blob/master/codes/java/leetcodes/src/main/java/com/hit/basmath/interview/top_interview_questions/easy_collection/array/_122.java) & Python|Easy| Array
905+
|122|[Best Time to Buy and Sell Stock II](https://leetcode.com/problems/best-time-to-buy-and-sell-stock-ii)|[Java](https://github.com/guobinhit/myleetcode/blob/master/codes/java/leetcodes/src/main/java/com/hit/basmath/interview/top_interview_questions/easy_collection/array/_122.java) & [Go](../master/codes/go/leetcodes/interview/easy_collection/122.go)|Easy| Array
906906
|125|[Valid Palindrome](https://leetcode.com/problems/valid-palindrome/description/)|[Java](https://github.com/guobinhit/myleetcode/blob/master/codes/java/leetcodes/src/main/java/com/hit/basmath/interview/top_interview_questions/easy_collection/strings/_125.java) & Python |Easy| Strings
907907
|136|[Single Number](https://leetcode.com/problems/single-number/description/)|[Java](https://github.com/guobinhit/myleetcode/blob/master/codes/java/leetcodes/src/main/java/com/hit/basmath/learn/hash_table/_136.java) & [Go](../master/codes/go/leetcodes/interview/easy_collection/136.go) |Easy| Array
908908
|141|[Linked List Cycle](https://leetcode.com/problems/linked-list-cycle/)|[Java](https://github.com/guobinhit/myleetcode/blob/master/codes/java/leetcodes/src/main/java/com/hit/basmath/learn/linked_list/_141.java) & [Go](../master/codes/go/leetcodes/interview/easy_collection/141.go)|Easy| Linked List
@@ -913,15 +913,15 @@ You can also ask for problem solving ideas and discuss in GitHub issues directly
913913
|198|[House Robber](https://leetcode.com/problems/house-robber/description/)|[Java](https://github.com/guobinhit/myleetcode/blob/master/codes/java/leetcodes/src/main/java/com/hit/basmath/interview/top_interview_questions/easy_collection/dynamic_programming/_198.java) & Python |Easy| Dynamic Programming
914914
|204|[Count Primes](https://leetcode.com/problems/count-primes/description/)|[Java](https://github.com/guobinhit/myleetcode/blob/master/codes/java/leetcodes/src/main/java/com/hit/basmath/interview/top_interview_questions/easy_collection/math/_204.java) & Python |Easy| Math
915915
|206|[Reverse Linked List](https://leetcode.com/problems/reverse-linked-list/description/)|[Java](https://github.com/guobinhit/myleetcode/blob/master/codes/java/leetcodes/src/main/java/com/hit/basmath/learn/linked_list/_206.java) & Python|Easy| Linked List
916-
|217|[Contains Duplicate](https://leetcode.com/problems/contains-duplicate/description/)|[Java](https://github.com/guobinhit/myleetcode/blob/master/codes/java/leetcodes/src/main/java/com/hit/basmath/learn/hash_table/_217.java) & Python |Easy| Array
917-
|234|[Palindrome Linked List](https://leetcode.com/problems/palindrome-linked-list/description/)|[Java](https://github.com/guobinhit/myleetcode/blob/master/codes/java/leetcodes/src/main/java/com/hit/basmath/learn/linked_list/_234.java) & Python|Easy| Linked List
918-
|237|[Delete Node in a Linked List](https://leetcode.com/problems/delete-node-in-a-linked-list/description/)|[Java](https://github.com/guobinhit/myleetcode/blob/master/codes/java/leetcodes/src/main/java/com/hit/basmath/interview/top_interview_questions/easy_collection/linked_list/_237.java) & Python |Easy| Linked List
916+
|217|[Contains Duplicate](https://leetcode.com/problems/contains-duplicate/description/)|[Java](https://github.com/guobinhit/myleetcode/blob/master/codes/java/leetcodes/src/main/java/com/hit/basmath/learn/hash_table/_217.java) & [Go](../master/codes/go/leetcodes/interview/easy_collection/217.go) |Easy| Array
917+
|234|[Palindrome Linked List](https://leetcode.com/problems/palindrome-linked-list/description/)|[Java](https://github.com/guobinhit/myleetcode/blob/master/codes/java/leetcodes/src/main/java/com/hit/basmath/learn/linked_list/_234.java) & [Go](../master/codes/go/leetcodes/interview/easy_collection/234.go)|Easy| Linked List
918+
|237|[Delete Node in a Linked List](https://leetcode.com/problems/delete-node-in-a-linked-list/description/)|[Java](https://github.com/guobinhit/myleetcode/blob/master/codes/java/leetcodes/src/main/java/com/hit/basmath/interview/top_interview_questions/easy_collection/linked_list/_237.java) & [Go](../master/codes/go/leetcodes/interview/easy_collection/237.go) |Easy| Linked List
919919
|242|[Valid Anagram](https://leetcode.com/problems/valid-anagram/description/)|[Java](https://github.com/guobinhit/myleetcode/blob/master/codes/java/leetcodes/src/main/java/com/hit/basmath/interview/top_interview_questions/easy_collection/strings/_242.java) & Python |Easy| Strings
920-
|268|[Missing Number](https://leetcode.com/problems/missing-number/description/)|[Java](https://github.com/guobinhit/myleetcode/blob/master/codes/java/leetcodes/src/main/java/com/hit/basmath/interview/top_interview_questions/easy_collection/others/_268.java) & Python |Easy| Others
920+
|268|[Missing Number](https://leetcode.com/problems/missing-number/description/)|[Java](https://github.com/guobinhit/myleetcode/blob/master/codes/java/leetcodes/src/main/java/com/hit/basmath/interview/top_interview_questions/easy_collection/others/_268.java) & [Go](../master/codes/go/leetcodes/interview/easy_collection/268.go) |Easy| Others
921921
|278|[First Bad Version](https://leetcode.com/problems/first-bad-version/description/)|[Java](https://github.com/guobinhit/myleetcode/blob/master/codes/java/leetcodes/src/main/java/com/hit/basmath/learn/binary_search/_278.java) & [Python](https://github.com/guobinhit/myleetcode/blob/master/codes/python/leetcodes/src/main/python/com/hit/basmath/learn/binary_search/_278.py)|Easy| Sorting and Searching
922922
|283|[Move Zeroes](https://leetcode.com/problems/move-zeroes/)|[Java](../master/codes/java/leetcodes/src/main/java/com/hit/basmath/learn/array_and_string/_283.java) & [Go](../master/codes/go/leetcodes/interview/easy_collection/283.go)| Easy| Array
923923
|326|[Power of Three](https://leetcode.com/problems/power-of-three/description/)|[Java](https://github.com/guobinhit/myleetcode/blob/master/codes/java/leetcodes/src/main/java/com/hit/basmath/interview/top_interview_questions/easy_collection/math/_326.java) & Python |Easy| Math
924-
|344|[Reverse String](https://leetcode.com/problems/reverse-string/description/)|[Java](https://github.com/guobinhit/myleetcode/blob/master/codes/java/leetcodes/src/main/java/com/hit/basmath/learn/array_and_string/_344.java) & Python| Easy| Strings
924+
|344|[Reverse String](https://leetcode.com/problems/reverse-string/description/)|[Java](https://github.com/guobinhit/myleetcode/blob/master/codes/java/leetcodes/src/main/java/com/hit/basmath/learn/array_and_string/_344.java) & [Go](../master/codes/go/leetcodes/interview/easy_collection/344.go)| Easy| Strings
925925
|350|[Intersection of Two Arrays II](https://leetcode.com/problems/intersection-of-two-arrays-ii/description/)|[Java](https://github.com/guobinhit/myleetcode/blob/master/codes/java/leetcodes/src/main/java/com/hit/basmath/learn/binary_search/_350.java) & Python |Easy| Array
926926
|384|[Shuffle an Array](https://leetcode.com/problems/shuffle-an-array/description/)|[Java](https://github.com/guobinhit/myleetcode/blob/master/codes/java/leetcodes/src/main/java/com/hit/basmath/interview/top_interview_questions/easy_collection/design/_384.java) & Python |Medium| Design
927927
|387|[First Unique Character in a String](https://leetcode.com/problems/first-unique-character-in-a-string/description/)|[Java](https://github.com/guobinhit/myleetcode/blob/master/codes/java/leetcodes/src/main/java/com/hit/basmath/learn/hash_table/_387.java) & Python |Easy| Strings

‎codes/go/leetcodes/go.mod‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ module github.com/guobinhit/myleetcodes
33
go 1.15
44

55
require (
6+
github.com/guobinhit/sylph v1.4.0
67
github.com/stretchr/testify v1.7.0
7-
github.com/guobinhit/sylph v1.3.3
88
)

‎codes/go/leetcodes/go.sum‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
22
github.com/guobinhit/sylph v1.3.3 h1:EUflyQ3MvrufyrGRC5sSo5ND94eeeASHw22zBMpUyrM=
33
github.com/guobinhit/sylph v1.3.3/go.mod h1:nvTaI9mV07YK//oYVLGG9MGqX7oy5xid/DDxp1eT3YE=
4+
github.com/guobinhit/sylph v1.4.0 h1:UDnKH3hp3ejHgnSXFyRA6DUSuTRP0ya4KNbGF5oDhPk=
5+
github.com/guobinhit/sylph v1.4.0/go.mod h1:nvTaI9mV07YK//oYVLGG9MGqX7oy5xid/DDxp1eT3YE=
46
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
57
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
68
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
package easy_collection
2+
3+
/**
4+
* 122. Best Time to Buy and Sell Stock II
5+
* <p>
6+
* Say you have an array for which the ith element is the price of a given stock on day i.
7+
* <p>
8+
* Design an algorithm to find the maximum profit. You may complete as many transactions as you like (i.e., buy one and sell one share of the stock multiple times).
9+
* <p>
10+
* Note: You may not engage in multiple transactions at the same time (i.e., you must sell the stock before you buy again).
11+
* <p>
12+
* Example 1:
13+
* <p>
14+
* Input: [7,1,5,3,6,4]
15+
* Output: 7
16+
* <p>
17+
* Explanation: Buy on day 2 (price = 1) and sell on day 3 (price = 5), profit = 5-1 = 4.
18+
* Then buy on day 4 (price = 3) and sell on day 5 (price = 6), profit = 6-3 = 3.
19+
* <p>
20+
* Example 2:
21+
* <p>
22+
* Input: [1,2,3,4,5]
23+
* Output: 4
24+
* <p>
25+
* Explanation: Buy on day 1 (price = 1) and sell on day 5 (price = 5), profit = 5-1 = 4.
26+
* Note that you cannot buy on day 1, buy on day 2 and sell them later, as you are
27+
* engaging multiple transactions at the same time. You must sell before buying again.
28+
* <p>
29+
* Example 3:
30+
* <p>
31+
* Input: [7,6,4,3,1]
32+
* Output: 0
33+
* <p>
34+
* Explanation: In this case, no transaction is done, i.e. max profit = 0.
35+
*/
36+
37+
func maxProfit2(prices []int) int {
38+
target := 0
39+
for i, p := range prices {
40+
if i > 0 {
41+
if p > prices[i-1] {
42+
target += p - prices[i-1]
43+
}
44+
}
45+
}
46+
return target
47+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
package easy_collection
2+
3+
/**
4+
* 217. Contains Duplicate
5+
* <p>
6+
* Given an array of integers, find if the array contains any duplicates.
7+
* <p>
8+
* Your function should return true if any value appears at least twice in the array, and it should return false if every element is distinct.
9+
* <p>
10+
* Example 1:
11+
* <p>
12+
* Input: [1,2,3,1]
13+
* Output: true
14+
* <p>
15+
* Example 2:
16+
* <p>
17+
* Input: [1,2,3,4]
18+
* Output: false
19+
* <p>
20+
* Example 3:
21+
* <p>
22+
* Input: [1,1,1,3,3,4,3,2,4,2]
23+
* Output: true
24+
*/
25+
26+
func containsDuplicate(nums []int) bool {
27+
aMap := make(map[int]struct{})
28+
for _, n := range nums {
29+
if _, ok := aMap[n]; ok {
30+
return true
31+
}
32+
aMap[n] = struct{}{}
33+
}
34+
return false
35+
}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
package easy_collection
2+
3+
/**
4+
* 234. Palindrome Linked List
5+
* <p>
6+
* Given a singly linked list, determine if it is a palindrome.
7+
* <p>
8+
* Example 1:
9+
* <p>
10+
* Input: 1->2
11+
* <p>
12+
* Output: false
13+
* <p>
14+
* Example 2:
15+
* <p>
16+
* Input: 1->2->2->1
17+
* <p>
18+
* Output: true
19+
* <p>
20+
* Follow up:
21+
* <p>
22+
* Could you do it in O(n) time and O(1) space?
23+
*/
24+
25+
/**
26+
* Definition for singly-linked list.
27+
* type ListNode struct {
28+
* Val int
29+
* Next *ListNode
30+
* }
31+
*/
32+
33+
func isPalindrome(head *ListNode) bool {
34+
nums := make([]int, 0)
35+
for head != nil {
36+
nums = append(nums, head.Val)
37+
head = head.Next
38+
}
39+
left := 0
40+
right := len(nums) - 1
41+
for left <= right {
42+
if nums[left] != nums[right] {
43+
return false
44+
}
45+
left++
46+
right--
47+
}
48+
return true
49+
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
package easy_collection
2+
3+
/**
4+
* 237. Delete Node in a Linked List
5+
* <p>
6+
* Write a function to delete a node (except the tail) in a singly linked list, given only access to that node.
7+
* <p>
8+
* Given linked list -- head = [4,5,1,9], which looks like following:
9+
* <p>
10+
* Example 1:
11+
* <p>
12+
* Input: head = [4,5,1,9], node = 5
13+
* Output: [4,1,9]
14+
* Explanation: You are given the second node with value 5, the linked list should become 4 -> 1 -> 9 after calling your function.
15+
* <p>
16+
* Example 2:
17+
* <p>
18+
* Input: head = [4,5,1,9], node = 1
19+
* Output: [4,5,9]
20+
* <p>
21+
* Explanation: You are given the third node with value 1, the linked list should become 4 -> 5 -> 9 after calling your function.
22+
* <p>
23+
* Note:
24+
* <p>
25+
* The linked list will have at least two elements.
26+
* All of the nodes' values will be unique.
27+
* The given node will not be the tail and it will always be a valid node of the linked list.
28+
* Do not return anything from your function.
29+
*/
30+
31+
/**
32+
* Definition for singly-linked list.
33+
* type ListNode struct {
34+
* Val int
35+
* Next *ListNode
36+
* }
37+
*/
38+
39+
func deleteNode(node *ListNode) {
40+
node.Val = node.Next.Val
41+
node.Next = node.Next.Next
42+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
package easy_collection
2+
3+
/**
4+
* 268. Missing Number
5+
* <p>
6+
* Given an array containing n distinct numbers taken from 0, 1, 2, ..., n, find the one that is missing from the array.
7+
* <p>
8+
* Example 1:
9+
* <p>
10+
* Input: [3,0,1]
11+
* Output: 2
12+
* <p>
13+
* Example 2:
14+
* <p>
15+
* Input: [9,6,4,2,3,5,7,0,1]
16+
* Output: 8
17+
* <p>
18+
* Note:
19+
* <p>
20+
* Your algorithm should run in linear runtime complexity. Could you implement it using only constant extra space complexity?
21+
*/
22+
23+
func missingNumber(nums []int) int {
24+
target := len(nums)
25+
for i, n := range nums {
26+
target ^= i ^ n
27+
28+
}
29+
return target
30+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
package easy_collection
2+
3+
/**
4+
* 344. Reverse String
5+
*
6+
* Write a function that reverses a string. The input string is given as an array of characters s.
7+
* You must do this by modifying the input array in-place with O(1) extra memory.
8+
*
9+
* Example 1:
10+
* Input: s = ["h","e","l","l","o"]
11+
* Output: ["o","l","l","e","h"]
12+
*
13+
* Example 2:
14+
* Input: s = ["H","a","n","n","a","h"]
15+
* Output: ["h","a","n","n","a","H"]
16+
*
17+
* Constraints:
18+
* 1 <= s.length <= 10^5
19+
* s[i] is a printable ascii character.
20+
*/
21+
22+
func reverseString(s []byte) {
23+
left := 0
24+
right := len(s) - 1
25+
for left < right {
26+
temp := s[left]
27+
s[left] = s[right]
28+
s[right] = temp
29+
left++
30+
right--
31+
}
32+
}
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
package easy_collection
2+
3+
/**
4+
* 48. Rotate Image
5+
* <p>
6+
* You are given an n x n 2D matrix representing an image.
7+
* <p>
8+
* Rotate the image by 90 degrees (clockwise).
9+
* <p>
10+
* Note:
11+
* <p>
12+
* You have to rotate the image in-place, which means you have to modify the input 2D matrix directly. DO NOT allocate another 2D matrix and do the rotation.
13+
* <p>
14+
* Example 1:
15+
* <p>
16+
* Given input matrix =
17+
* <p>
18+
* [
19+
* [1,2,3],
20+
* [4,5,6],
21+
* [7,8,9]
22+
* ],
23+
* <p>
24+
* rotate the input matrix in-place such that it becomes:
25+
* <p>
26+
* [
27+
* [7,4,1],
28+
* [8,5,2],
29+
* [9,6,3]
30+
* ]
31+
* <p>
32+
* Example 2:
33+
* <p>
34+
* Given input matrix =
35+
* <p>
36+
* [
37+
* [ 5, 1, 9,11],
38+
* [ 2, 4, 8,10],
39+
* [13, 3, 6, 7],
40+
* [15,14,12,16]
41+
* ],
42+
* <p>
43+
* rotate the input matrix in-place such that it becomes:
44+
* <p>
45+
* [
46+
* [15,13, 2, 5],
47+
* [14, 3, 4, 1],
48+
* [12, 6, 8, 9],
49+
* [16, 7,10,11]
50+
* ]
51+
*/
52+
53+
func rotate(matrix [][]int) {
54+
left := 0
55+
right := len(matrix) - 1
56+
for left < right {
57+
temp := matrix[left]
58+
matrix[left] = matrix[right]
59+
matrix[right] = temp
60+
left++
61+
right--
62+
}
63+
for i := 0; i < len(matrix); i++ {
64+
for j := i + 1; j < len(matrix[i]); j++ {
65+
temp := matrix[i][j]
66+
matrix[i][j] = matrix[j][i]
67+
matrix[j][i] = temp
68+
}
69+
}
70+
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /