04 2015 档案

【Linked List Cycle II】cpp
摘要:题目:Given a linked list, return the node where the cycle begins. If there is no cycle, returnnull.Follow up:Can you solve it without using extra space?... 阅读全文

posted @ 2015-04-30 23:55 承续缘 阅读(144) 评论(0) 推荐(0) 编辑

【Linked List Cycle】cpp
摘要:题目:Given a linked list, determine if it has a cycle in it.Follow up:Can you solve it without using extra space?代码:用hashmap版/** * Definition for singly... 阅读全文

posted @ 2015-04-30 23:21 承续缘 阅读(198) 评论(0) 推荐(0) 编辑

【Copy List with Random Pointer】cpp
摘要:题目:A linked list is given such that each node contains an additional random pointer which could point to any node in the list or null.Return a deep co... 阅读全文

posted @ 2015-04-30 15:40 承续缘 阅读(240) 评论(0) 推荐(0) 编辑

【Reverse Nodes in k-Group】cpp
摘要:题目:Given a linked list, reverse the nodes of a linked listkat a time and return its modified list.If the number of nodes is not a multiple ofkthen lef... 阅读全文

posted @ 2015-04-30 10:42 承续缘 阅读(247) 评论(0) 推荐(0) 编辑

【Swap Nodes in Pairs】cpp
摘要:题目:Given a linked list, swap every two adjacent nodes and return its head.For example,Given1->2->3->4, you should return the list as2->1->4->3.Your al... 阅读全文

posted @ 2015-04-30 09:41 承续缘 阅读(168) 评论(0) 推荐(0) 编辑

【Remove Nth Node From End of List】cpp
摘要:题目:Given a linked list, remove thenthnode from the end of list and return its head.For example, Given linked list: 1->2->3->4->5, and n = 2. After... 阅读全文

posted @ 2015-04-30 09:16 承续缘 阅读(203) 评论(0) 推荐(0) 编辑

【Rotate List】cpp
摘要:题目:Given a list, rotate the list to the right bykplaces, wherekis non-negative.For example:Given1->2->3->4->5->NULLandk=2,return4->5->1->2->3->NULL.代码... 阅读全文

posted @ 2015-04-29 23:10 承续缘 阅读(172) 评论(0) 推荐(0) 编辑

【Remove Duplicates from Sorted List II 】cpp
摘要:题目:Given a sorted linked list, delete all nodes that have duplicate numbers, leaving onlydistinctnumbers from the original list.For example,Given1->2-... 阅读全文

posted @ 2015-04-29 19:19 承续缘 阅读(199) 评论(0) 推荐(0) 编辑

【Partition List】cpp
摘要:题目:Given a linked list and a valuex, partition it such that all nodes less thanxcome before nodes greater than or equal tox.You should preserve the or... 阅读全文

posted @ 2015-04-29 09:32 承续缘 阅读(207) 评论(0) 推荐(0) 编辑

【Reverse Linked List II】cpp
摘要:题目:Reverse a linked list from positionmton. Do it in-place and in one-pass.For example:Given1->2->3->4->5->NULL,m= 2 andn= 4,return1->4->3->2->5->NULL... 阅读全文

posted @ 2015-04-29 08:58 承续缘 阅读(176) 评论(0) 推荐(0) 编辑

【Add Two Numbers】
摘要:题目:You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a sing... 阅读全文

posted @ 2015-04-28 22:02 承续缘 阅读(155) 评论(0) 推荐(0) 编辑

【Single Num II】cpp
摘要:题目:Given an array of integers, every element appearsthreetimes except for one. Find that single one.Note:Your algorithm should have a linear runtime c... 阅读全文

posted @ 2015-04-27 20:27 承续缘 阅读(180) 评论(0) 推荐(0) 编辑

【Single Number】cpp
摘要:题目:Given an array of integers, every element appearstwiceexcept for one. Find that single one.Note:Your algorithm should have a linear runtime complex... 阅读全文

posted @ 2015-04-27 14:37 承续缘 阅读(164) 评论(0) 推荐(0) 编辑

【Candy】cpp
摘要:题目:There areNchildren standing in a line. Each child is assigned a rating value.You are giving candies to these children subjected to the following re... 阅读全文

posted @ 2015-04-27 10:48 承续缘 阅读(230) 评论(0) 推荐(0) 编辑

【Gas Station】cpp
摘要:题目:There areNgas stations along a circular route, where the amount of gas at stationiisgas[i].You have a car with an unlimited gas tank and it costsco... 阅读全文

posted @ 2015-04-27 00:01 承续缘 阅读(209) 评论(0) 推荐(0) 编辑

【Set Matrix Zeros】cpp
摘要:题目:Given amxnmatrix, if an element is 0, set its entire row and column to 0. Do it in place.click to show follow up.Follow up:Did you use extra space?... 阅读全文

posted @ 2015-04-26 23:16 承续缘 阅读(181) 评论(0) 推荐(0) 编辑

【Gray Code】cpp
摘要:题目:The gray code is a binary numeral system where two successive values differ in only one bit.Given a non-negative integernrepresenting the total num... 阅读全文

posted @ 2015-04-26 20:30 承续缘 阅读(203) 评论(0) 推荐(0) 编辑

【Climbing Stairs】cpp
摘要:题目:You are climbing a stair case. It takesnsteps to reach to the top.Each time you can either climb 1 or 2 steps. In how many distinct ways can you cl... 阅读全文

posted @ 2015-04-26 17:52 承续缘 阅读(164) 评论(0) 推荐(0) 编辑

【Plus One】cpp
摘要:题目: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... 阅读全文

posted @ 2015-04-26 16:52 承续缘 阅读(205) 评论(0) 推荐(0) 编辑

【Rotate Image】cpp
摘要:题目:You are given annxn2D matrix representing an image.Rotate the image by 90 degrees (clockwise).Follow up:Could you do this in-place?代码:class Solutio... 阅读全文

posted @ 2015-04-26 16:29 承续缘 阅读(143) 评论(0) 推荐(0) 编辑

【Trapping Rain Water】cpp
摘要:题目:Givennnon-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after raining... 阅读全文

posted @ 2015-04-26 10:02 承续缘 阅读(189) 评论(0) 推荐(0) 编辑

【Valid Sudoku】cpp
摘要:题目:Determine if a Sudoku is valid, according to:Sudoku Puzzles - The Rules.The Sudoku board could be partially filled, where empty cells are filled wi... 阅读全文

posted @ 2015-04-25 22:27 承续缘 阅读(220) 评论(0) 推荐(0) 编辑

【Permutation Sequence】cpp
摘要:题目:The set[1,2,3,…,n]contains a total ofn! unique permutations.By listing and labeling all of the permutations in order,We get the following sequence ... 阅读全文

posted @ 2015-04-24 09:05 承续缘 阅读(214) 评论(0) 推荐(0) 编辑

【Next Permutation】cpp
摘要:题目:Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers.If such arrangement is not poss... 阅读全文

posted @ 2015-04-23 16:24 承续缘 阅读(200) 评论(0) 推荐(0) 编辑

【Remove Elements】cpp
摘要:题目:Given an array and a value, remove all instances of that value in place and return the new length.The order of elements can be changed. It doesn't ... 阅读全文

posted @ 2015-04-23 14:26 承续缘 阅读(236) 评论(0) 推荐(0) 编辑

【4Sum】cpp
摘要:题目:Given an arraySofnintegers, are there elementsa,b,c, anddinSsuch thata+b+c+d= target? Find all unique quadruplets in the array which gives the sum ... 阅读全文

posted @ 2015-04-23 13:09 承续缘 阅读(169) 评论(0) 推荐(0) 编辑

【3Sum Closest 】cpp
摘要:题目:Given an arraySofnintegers, find three integers inSsuch that the sum is closest to a given number, target. Return the sum of the three integers. Yo... 阅读全文

posted @ 2015-04-19 21:00 承续缘 阅读(217) 评论(0) 推荐(0) 编辑

【3Sum】cpp
摘要:题目:Given an arraySofnintegers, are there elementsa,b,cinSsuch thata+b+c= 0? Find all unique triplets in the array which gives the sum of zero.Note:Ele... 阅读全文

posted @ 2015-04-19 15:35 承续缘 阅读(212) 评论(0) 推荐(0) 编辑

【Two Sum】cpp
摘要:题目: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... 阅读全文

posted @ 2015-04-18 11:18 承续缘 阅读(318) 评论(0) 推荐(0) 编辑

【Longest Consecutive Sequence】cpp
摘要:题目:Given an unsorted array of integers, find the length of the longest consecutive elements sequence.For example,Given[100, 4, 200, 1, 3, 2],The longe... 阅读全文

posted @ 2015-04-17 22:47 承续缘 阅读(168) 评论(0) 推荐(0) 编辑

【Median of Two Sorted Arrays】cpp
摘要:题目:There are two sorted arrays A and B of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should ... 阅读全文

posted @ 2015-04-17 18:56 承续缘 阅读(139) 评论(0) 推荐(0) 编辑

【Search In Rotated Sorted Array】cpp
摘要:题目:Suppose a sorted array is rotated at some pivot unknown to you beforehand.(i.e.,0 1 2 4 5 6 7might become4 5 6 7 0 1 2).You are given a target valu... 阅读全文

posted @ 2015-04-15 22:51 承续缘 阅读(167) 评论(0) 推荐(0) 编辑

【Remove Duplicates from Sorted Array II】cpp
摘要:题目:Follow up for "Remove Duplicates":What if duplicates are allowed at mosttwice?For example,Given sorted array A =[1,1,1,2,2,3],Your function should ... 阅读全文

posted @ 2015-04-15 08:57 承续缘 阅读(173) 评论(0) 推荐(0) 编辑

【Remove Duplicates from Sorted Array】cpp
摘要:题目:https://leetcode.com/problems/remove-duplicates-from-sorted-array/Given a sorted array, remove the duplicates in place such that each element appea... 阅读全文

posted @ 2015-04-13 22:26 承续缘 阅读(205) 评论(0) 推荐(0) 编辑

Python刷题到底为止-开始cpp刷题
摘要:RT今天开刷,入cpp的坑 阅读全文

posted @ 2015-04-13 21:47 承续缘 阅读(284) 评论(0) 推荐(0) 编辑

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

统计

点击右上角即可分享
微信分享提示