LeetCode练习
KingfarOu
这个作者很懒,什么都没留下…
展开
-
leetCode26:Remove Duplicates from Sorted Array
Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length.Do not allocate extra space for another array, you must do this in place with原创 2015-12-31 16:25:35 · 516 阅读 · 0 评论 -
LeetCode219题:Contains Duplicate II
Given an array of integers and an integer k, find out whether there are two distinct indices i and j in the array such that nums[i] = nums[j] and the difference between i and j is at most k.原创 2016-03-04 19:14:48 · 562 阅读 · 0 评论 -
leetCode88:Merge Sorted Array
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 addit原创 2016-03-15 21:05:14 · 482 阅读 · 0 评论 -
leetCode:234: Palindrome Linked List
C语言实现判断某链表是否属于回文链表原创 2015-12-25 10:10:02 · 452 阅读 · 0 评论 -
leetCode1: Two Sum
Given an array of integers, find two numbers such that they add up to a specific target number.The function twoSum should return indices of the two numbers such that they add up to the target, whe原创 2016-01-14 16:54:10 · 367 阅读 · 0 评论 -
LeetCode,141:Linked List Cycle
C语言实现判断单链表是否带有循环LeetCode原题如下:Given a linked list, determine if it has a cycle in it.Follow up:Can you solve it without using extra space?对于一个普通的单链表(双向链表以及循环链表不算在内),链表最后一个元素指针==NULL,一原创 2015-12-25 10:38:33 · 370 阅读 · 0 评论 -
leetCode61:Rotate List
Given a list, rotate the list to the right by k places, where k is non-negative.For example:Given 1->2->3->4->5->NULL and k = 2,return 4->5->1->2->3->NULL.问题需求:将单链表循环右移,移动次数有参数所决定。问题分析原创 2015-12-27 14:20:42 · 407 阅读 · 0 评论 -
leetCode24:Swap Nodes in Pairs
Given a linked list, swap every two adjacent nodes and return its head.For example,Given 1->2->3->4, you should return the list as 2->1->4->3.Your algorithm should use only constant space. Y原创 2015-12-26 16:03:18 · 343 阅读 · 0 评论 -
leetCode2:Add Two Numbers
/** * Definition for singly-linked list. * struct ListNode { * int val; * struct ListNode *next; * }; */struct ListNode* addTwoNumbers(struct ListNode* l1, struct ListNode* l2) {原创 2015-12-26 14:08:37 · 80 阅读 · 0 评论 -
leetCode75:Sort Colors
Given an array with n objects colored red, white or blue, sort them so that objects of the same color are adjacent, with the colors in the order red, white and blue.Here, we will use the integers原创 2016-01-01 11:33:45 · 329 阅读 · 0 评论 -
LeetCode66: Plus One
Given a non-negative number represented as an array of digits, plus one to the number.The digits are stored such that the most significant digit is at the head of the list./** * Return an arr原创 2016-03-04 14:38:57 · 624 阅读 · 0 评论