![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Leetcode
文章平均质量分 50
xm1991happy
这个作者很懒,什么都没留下…
展开
-
Leetcode 217
Given an array of integers, find if the array contains any duplicates. Your function should return true if any value appears at least twice in the array, and it should return false if every element原创 2016-03-30 11:46:14 · 156 阅读 · 0 评论 -
Leetcode 144
Given a binary tree, return the preorder traversal of its nodes' values.For example:Given binary tree {1,#,2,3}, 1 \ 2 / 3return [1,2,3]./** * Definition for原创 2016-06-21 15:04:49 · 312 阅读 · 0 评论 -
Leetcode 94
Given a binary tree, return the inorder traversal of its nodes' values.For example:Given binary tree [1,null,2,3], 1 \ 2 / 3return [1,3,2]./** * Definition fo原创 2016-06-21 14:55:12 · 212 阅读 · 0 评论 -
Leetcode 19
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 removing the second node from the end, the原创 2016-07-05 10:46:40 · 186 阅读 · 0 评论 -
Leetcode 26
Given a sorted array, remove the duplicates in place such that each element appear only once and returclass Solution {public: int removeDuplicates(vector& nums) { int size = nums.size();原创 2016-06-24 15:16:37 · 203 阅读 · 0 评论 -
Leetcode 206
Reverse a singly linked list.Recursion:/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * };原创 2016-03-30 11:36:01 · 238 阅读 · 0 评论 -
Leetcode 83
Given a sorted linked list, delete all duplicates such that each element appear only once.For example,Given 1->1->2, return 1->2.Given 1->1->2->3->3, return 1->2->3./** * Definition f原创 2016-04-11 14:54:22 · 235 阅读 · 0 评论 -
Leetcode 328
Given a singly linked list, group all odd nodes together followed by the even nodes. Please note here we are talking about the node number and not the value in the nodes.You should try to do it in原创 2016-03-31 17:39:12 · 195 阅读 · 0 评论 -
Leetcode 13
Given a roman numeral, convert it to an integer.Input is guaranteed to be within the range from 1 to 3999.class Solution {public: int romanToInt(string s) { int m=0,i=0,j=0,k=0; whil原创 2016-03-31 14:38:56 · 165 阅读 · 0 评论 -
Leetcode 169
Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times.You may assume that the array is non-empty and the majority element原创 2016-03-30 11:41:36 · 238 阅读 · 0 评论 -
Leetcode 171
Related to question Excel Sheet Column TitleGiven a column title as appear in an Excel sheet, return its corresponding column number.For example: A -> 1 B -> 2 C -> 3 ..原创 2016-03-30 11:44:09 · 225 阅读 · 0 评论 -
Leetcode 88
Given two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array.Note:You may assume that nums1 has enough space (size that is greater or equal to m + n) to hold add原创 2016-06-21 15:08:16 · 186 阅读 · 0 评论