leetcode编程
二姐不想去实验室
程序媛一枚,哈哈~~~~~
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
leetcode: wildcard matching
Implement wildcard pattern matching with support for '?' and '*'. '?' Matches any single character. '*' Matches any sequence of characters (including the empty sequence). The matching should cover t原创 2015-03-12 16:14:08 · 433 阅读 · 0 评论 -
2014年阿里研发笔试题:在text中找出以同样的顺序连续出现在query中的最长连续字母序列的长度
题目描述:给定一个query和一个text,均由小写字母组成。要求在text中找出以同样的顺序连续出现在query中的最长连续字母序列的长度。例如, query为“acbac”,text为“acaccbabb”,那么text中的“cba”为最长的连续出现在query中的字母序列,因此,返回结果应该为其长度3。请注意程序效率。 思想:用vector建立一个二维向量markMatrix,markMa原创 2015-03-15 18:36:34 · 1149 阅读 · 0 评论 -
leetcode: Jump Game
Jump Game Total Accepted: 37122 Total Submissions: 135980My Submissions Question Solution Given an array of non-negative integers, you are initially positioned at the first index原创 2015-03-21 11:42:45 · 396 阅读 · 0 评论 -
leetcode:combination sum
Given a set of candidate numbers (C) and a target number (T), find all unique combinations in C where the candidate numbers sums to T. The same repeated number may be chosen from C unlimited numb原创 2015-05-30 11:14:52 · 409 阅读 · 0 评论 -
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. Note: Elements in a triplet (a,b,c) must原创 2015-09-03 22:40:20 · 337 阅读 · 0 评论 -
Combination Sum II
Combination Sum II (未!!!) Given a collection of candidate numbers (C) and a target number (T), find all unique combinations in C where the candidate numbers sums to T. Each number in C may onl原创 2015-09-03 23:10:49 · 346 阅读 · 0 评论 -
单链表反转
给定一个单链表,实现单链表的反转 /** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */ class Solution { public原创 2015-09-10 15:15:01 · 325 阅读 · 0 评论 -
Combinations
Given two integers n and k, return all possible combinations of k numbers out of 1 ... n. For example, If n = 4 and k = 2, a solution is: [ [2,4], [3,4], [2,3], [1,2], [1,3], [1,4], ] Hide原创 2015-09-04 23:09:37 · 315 阅读 · 0 评论 -
leetcode—有关区间合并
题目一: Merge Intervals Given a collection of intervals, merge all overlapping intervals. For example, Given [1,3],[2,6],[8,10],[15,18], return [1,6],[8,10],[15,18]. Hide Tags Array Sort原创 2015-10-09 17:52:11 · 453 阅读 · 0 评论 -
[LeetCode] [Shell] Valid phone numbers
原创 2018-05-09 09:06:28 · 326 阅读 · 1 评论 -
leetcode: 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, where原创 2015-03-09 11:41:11 · 400 阅读 · 0 评论 -
remove element
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 matter what you leave beyond the new length.原创 2015-03-08 16:48:21 · 291 阅读 · 0 评论 -
rotate array
Rotate an array of n elements to the right by k steps. For example, with n = 7 and k = 3, the array [1,2,3,4,5,6,7] is rotated to [5,6,7,1,2,3,4]. Note: Try to come up as many solutions as you c原创 2015-03-07 19:42:51 · 431 阅读 · 0 评论 -
LeetCode题目总结/分类
http://www.douban.com/note/330562764/ 注:此分类仅供大概参考,没有精雕细琢。有不同意见欢迎评论~ 欢迎参考我的leetcode代码 利用堆栈: http://oj.leetcode.com/problems/evaluate-reverse-polish-notation/ http://oj.leetcode.com/problems/转载 2015-03-07 20:49:49 · 441 阅读 · 0 评论 -
leetcode: Candy
There are N children standing in a line. Each child is assigned a rating value. You are giving candies to these children subjected to the following requirements: Each child must have at least one原创 2015-03-21 10:40:21 · 416 阅读 · 0 评论 -
leetcode: rotate image
You are given an n x n 2D matrix representing an image. Rotate the image by 90 degrees (clockwise). Follow up: Could you do this in-place? Hide Tags Array #include #include using namespace原创 2015-03-10 11:35:27 · 419 阅读 · 0 评论 -
leetcode: string to integer (atoi)
Implement atoi to convert a string to an integer. Hint: Carefully consider all possible input cases. If you want a challenge, please do not see below and ask yourself what are the possible input ca原创 2015-03-11 16:00:03 · 317 阅读 · 0 评论 -
leetcode: length of last word
Given a string s consists of upper/lower-case alphabets and empty space characters ' ', return the length of last word in the string. If the last word does not exist, return 0. Note: A word is原创 2015-03-12 16:17:05 · 366 阅读 · 0 评论 -
ZigZag Convert
The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility) P A H N A P L S I原创 2015-03-14 11:45:28 · 342 阅读 · 0 评论 -
leetcode: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 all va原创 2015-03-14 16:41:55 · 311 阅读 · 0 评论 -
leetcode:Number Of 1 Bits
Write a function that takes an unsigned integer and returns the number of ’1' bits it has (also known as the Hamming weight). For example, the 32-bit integer ’11' has binary representation 00000000原创 2015-04-03 15:54:29 · 401 阅读 · 0 评论 -
leetcode : reverse Bits
Reverse bits of a given 32 bits unsigned integer. For example, given input 43261596 (represented in binary as 00000010100101000001111010011100), return 964176192 (represented in binary as0011100101原创 2015-04-11 21:16:47 · 374 阅读 · 0 评论 -
leetcode :reverse integer
Reverse Integer Example1: x = 123, return 321 Example2: x = -123, return -321 _________________________________ 注意溢出问题的处理; int reverse(long long x) { int flag = 0; co原创 2015-04-12 18:21:25 · 376 阅读 · 0 评论 -
leetcode: 3SumClosest
题目: 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原创 2015-05-06 10:22:29 · 407 阅读 · 0 评论 -
[Leetcode][Shell] Tenth Line
[Description] Given a text file file.txt, print just the 10th line of the file.Example: file.txt Line 1 Line 2 Line 3 Line 4 Line 5 Line 6 Line 7 Line 8 Line 9 Line 10 ou原创 2018-05-08 09:20:35 · 212 阅读 · 0 评论
分享