最新 最热

leetcode 13 Roman to Integer

class Solution {public: int romanToInt(string s) { int res = 0; unordered_map<char, int> m{{&#x27;I&#x27;, 1}, {&#x27;V&#x27;, 5}, {&#x27;X&#x27;, 10}, {&#x27;L&#x27;, 50}, {&#x27;C&#...

2018-06-04
1

leetcode 15 3Sum

class Solution {public: vector<vector<int>> threeSum(vector<int>& nums) { set<vector<int>> res; sort(nums.begin(), nums.end()); for...

2018-06-04
0

leetcode 2 Add two numbers

public class Solution { public ListNode addTwoNumbers(ListNode l1, ListNode l2) { ListNode dummy = new ListNode(-1); ListNode cur = dummy; ...

2018-06-04
1

【专知-关关的刷题日记20】Leetcode 119. Pascal&#39;s Triangle II

题目Given an index k, return the kth row of the Pascal&#x27;s triangle.For example, given k = 3,Return [1,3,3,1].这道题是118题的延续,要求给定数字k,返回杨辉三角的第k行,这里把最开始的[1]这一行看作了第0行。...

2018-04-09
1

Leetcode 19 Remove Nth Node From End of List 超简洁代码

Given a linked list, remove the nth node from the end of list and return its head. For example, Given linked list: 1->2->3->4->5, and n = 2. After remo...

2018-01-12
1

Leetcode 15 3Sum + 有趣的小BUG

Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all u

2018-01-12
1

Leetcode 130 Surrounded Regions

Given a 2D board containing &#x27;X&#x27; and &#x27;O&#x27; (the letter O), capture all regions surrounded by &#x27;X&#x27;. A region is captured by flipping all &#x27;O&#x27;s into &#x27;X&...

2018-01-12
1

Leetcode 206 Reverse Linked List

Reverse a singly linked list. 链表逆置,之前好像做过类似的Leetcode题目了。/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next;...

2018-01-12
1