- 博客(15)
- 收藏
- 关注
原创 leetcode 23. Merge k Sorted Lists
题目:Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity.合并k个排好序的的链,并且返回一个有序链。方法一:想到21题是合并两个排好序的链,那么这个题可以借鉴思想。每次从数组中取两个链表,将合并结果加入到链表中,反复
2016-05-31 11:01:03 324
原创 leetcode 22. Generate Parentheses
题目:Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.n:n对儿括号,写一个函数,生成所有括号的组合方式For example, given n = 3, a solution set is:"((()))
2016-05-30 09:54:54 258
原创 leetcode 21. Merge Two Sorted Lists
题目:Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists.合并两个已经排好序的链。新的链应该是合并两个链。(那么意思是不可以申请新空间)第一次
2016-05-27 09:49:13 253
原创 leetcode 20. Valid Parentheses
题目:Given a string containing just the characters '(', ')','{', '}', '[' and ']', determine if the input string is valid.The brackets must close in the correct order, "()" and "()[]{}" are al
2016-05-26 09:18:10 203
原创 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 removing the second node from the end,
2016-05-25 16:03:12 263
原创 leetcode 18. 4Sum
Given an array S of n integers, are there elements a,b, c, and d in S such that a + b +c + d = target? Find all unique quadruplets in the array which gives the sum of target.Note:Elements
2016-05-24 18:06:33 213
原创 leetcode 17. Letter Combinations of a Phone Number
Given a digit string, return all possible letter combinations that the number could represent.A mapping of digit to letters (just like on the telephone buttons) is given below.Input:Digit string
2016-05-23 10:28:04 280
原创 leetcode 16. 3Sum Closest
Given an array S of n integers, find three integers in S such that the sum is closest to a given number, target. Return the sum of the three integers. You may assume that each input would have exa
2016-05-19 09:46:38 250
原创 leetcode 232. Implement Queue using Stacks
Implement the following operations of a queue using stacks.利用堆栈完成下列队列操作push(x) -- Push element x to the back of queue.将元素放入队列最末尾pop() -- Removes the element from in front of queue.移除队列首部的元素pee
2016-05-18 16:50:13 355
原创 leetcode 15. 3Sum
Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero.提供一个包含了n个int型数据的数组,判断是否里面存在这样的三个数a b c,
2016-05-17 09:10:30 283
原创 求二叉树的深度
编程求解该二叉树的深度(设根树的深度为1)。树节点结构体typedef struct BiTNode{ char data; struct BiTNode *lchild,*rchild;}BiTNode,*BiTree;二叉树深度(根节点为1)int height(BiTree T) //求解二叉树深度的函数{ int i,
2016-05-12 15:24:55 392
原创 136. Single Number
题目Given an array of integers, every element appears twice except for one. Find that single one.Note:Your algorithm should have a linear runtime complexity. Could you implement it without using e
2016-05-12 10:40:26 208
原创 一元非线性回归-多项式函数拟合
推导过程: 1. 设拟合多项式为: 2. 各点到这条曲线的距离之和,即偏差平方和如下: 3. 为了求得符合条件的a值,对等式右边求ai偏导数,因而我们得到了:
2016-05-11 20:50:24 9461 1
原创 345. Reverse Vowels of a String
题目:Write a function that takes a string as input and reverse only the vowels of a string.Example 1:Given s = "hello", return "holle". Example 2:Given s = "leetcode", return "leotcede".
2016-05-10 20:45:03 417
原创 leetcode 17. Letter Combinations of a Phone Number
1.题目Given a digit string, return all possible letter combinations that the number could represent.A mapping of digit to letters (just like on the telephone buttons) is given below.Input:
2016-05-09 17:35:21 249
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人