原创 2.1.20 Set Matrix Zeroes

Link: https://oj.leetcode.com/problems/set-matrix-zeroes/ 我的思路:用第0列存儲每一行是否有0。需要用第一行存儲每一列是否有0嗎? 我的代碼:不正確。需要重做。//錯誤的原因是:m

原创 2.1.19 Gray Code

Link: https://oj.leetcode.com/problems/gray-code/ The gray code is a binary numeral system where two successive values

原创 2.1.22 Candy

Link: https://oj.leetcode.com/problems/candy/ There are N children standing in a line. Each child is assigned a rating

原创 2.1.21 Gas Station

Link: https://oj.leetcode.com/problems/gas-station/ There are N gas stations along a circular route, where the amount

原创 2.2.8 Swap Nodes in Pairs

Link: https://oj.leetcode.com/problems/swap-nodes-in-pairs/ Given a linked list, swap every two adjacent nodes and ret

原创 2.2.9 Reverse Nodes in K-group

Link: https://oj.leetcode.com/problems/reverse-nodes-in-k-group/ Given a linked list, reverse the nodes of a linked li

原创 2.1.23 Single Number

Link: https://oj.leetcode.com/problems/single-number/ Given an array of integers, every element appears twice except f

原创 2.2.1 Add Two Numbers

Link: https://oj.leetcode.com/problems/add-two-numbers/ You are given two linked lists representing two non-negative n

原创 2.2.4 Remove Duplicates from Sorted List

Link: https://oj.leetcode.com/problems/remove-duplicates-from-sorted-list/ Given a sorted linked list, delete all dupl