- 博客(185)
- 资源 (1)
- 收藏
- 关注
原创 lintcode 427. 生成括号
427. 生成括号 题目: 描述 给定 n 对括号,请写一个函数以将其生成新的括号组合,并返回所有组合结果。 您在真实的面试中是否遇到过这个题? 是 样例 给定 n = 3, 可生成的组合如下: "((()))", "(()())", "(())()", "()...
2018-08-27 13:25:58
422
原创 LintCode 69. 二叉树的层次遍历
69. 二叉树的层次遍历描述给出一棵二叉树,返回其节点值的层次遍历(逐层从左往右访问)样例给一棵二叉树 {3,9,20,#,#,15,7} : 3 / \ 9 20 / \ 15 7 返回他的分层遍历结果:[ [3], [9,20], [15,7] ] 挑战挑战1:只使用一个队列去实现它挑战2:用DFS算法来做题目链接:https://www.lintcode.com...
2018-05-17 17:12:56
382
原创 LintCode 67. 二叉树的中序遍历
67. 二叉树的中序遍历描述给出一棵二叉树,返回其中序遍历样例给出二叉树 {1,#,2,3}, 1 \ 2 / 3返回 [1,3,2]题目链接:https://www.lintcode.com/problem/binary-tree-inorder-traversal/description解题思路1:(递归)递归得到左子树的中序遍历的vector数组,把当前结...
2018-05-17 15:04:50
451
原创 Leetcode 91. Decode Ways (string)
91. Decode Ways A message containing letters from A-Z is being encoded to numbers using the following mapping: 'A' -> 1 'B' -> 2 ... 'Z' -> 26 Given an encoded message containing digits, det
2018-03-09 10:59:59
337
原创 Leetcode 74. Search a 2D Matrix
74. Search a 2D Matrix Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties: Integers in each row are sorted from left to rig
2018-03-04 18:19:45
284
原创 Leetcode 45. Jump Game II(dp)
45. Jump Game II Given an array of non-negative integers, you are initially positioned at the first index of the array. Each element in the array represents your maximum jump length at that posi
2018-03-03 14:58:34
468
原创 Leetcode 48. Min Cost Climbing Stairs
48. Min Cost Climbing Stairs On a staircase, the i-th step has some non-negative cost cost[i] assigned (0 indexed). Once you pay the cost, you can either climb one or two steps. You need to find
2018-03-02 17:24:47
268
原创 Leetcode 62. Unique Paths
62. Unique Paths A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below). The robot can only move either down or right at any point in time. The robot i
2018-03-02 13:55:25
245
原创 Leetcode 51. N-Queens
51. N-Queens The n-queens puzzle is the problem of placing n queens on an n×n chessboard such that no two queens attack each other. Given an integer n, return all distinct solutions to the n-
2018-03-01 21:34:43
224
原创 Leetcode 55. Jump Game
55. Jump Game Given an array of non-negative integers, you are initially positioned at the first index of the array. Each element in the array represents your maximum jump length at that positio
2018-03-01 16:08:58
515
原创 Leetcode 53. Maximum Subarray
53. Maximum Subarray Find the contiguous subarray within an array (containing at least one number) which has the largest sum. For example, given the array [-2,1,-3,4,-1,2,1,-5,4], the contiguous
2018-02-04 11:36:19
275
原创 Leetcode 49. Group Anagrams
49. Group Anagrams Given an array of strings, group anagrams together. For example, given: ["eat", "tea", "tan", "ate", "nat", "bat"], Return: [ ["ate", "eat","tea"], ["nat","tan"], ["
2018-02-03 20:18:53
235
原创 Leetcode 48. Rotate Image
48. Rotate Image You are given an n x n 2D matrix representing an image. Rotate the image by 90 degrees (clockwise). Note: You have to rotate the image in-place, which means you have to modify t
2018-02-03 17:50:57
237
原创 Leetcode 46. Permutations (全排列)
46. Permutations DescriptionHintsSubmissionsDiscussSolution Given a collection of distinct numbers, return all possible permutations. For example, [1,2,3] have
2018-02-03 16:51:35
305
原创 Leetcode 39. Combination Sum (递归)
39. Combination Sum Given a set of candidate numbers (C) (without duplicates) and a target number (T), find all unique combinations in C where the candidate numbers sums to T. The same repeat
2018-01-23 20:00:46
390
原创 Leetcode 15. 3Sum
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. Note: The solution set must
2018-01-19 13:37:06
216
原创 Leetcode 29. Divide Two Integers
29. Divide Two Integers Divide two integers without using multiplication, division and mod operator. If it is overflow, return MAX_INT. 题目链接:https://leetcode.com/problems/divide-two-inte
2018-01-16 21:00:56
227
原创 Leetcode 3. Longest Substring Without Repeating Characters
3. Longest Substring Without Repeating Characters Given a string, find the length of the longest substring without repeating characters. Examples: Given "abcabcbb", the answer is "abc", which
2018-01-16 19:14:39
313
原创 Leetcode 21. Merge Two Sorted Lists
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. Example: Input: 1->2->4, 1
2018-01-16 16:31:33
254
原创 Leetcode 26. Remove Duplicates from Sorted Array
26. 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 a
2018-01-16 13:31:56
211
原创 Leetcode 650. 2 Keys Keyboard
650. 2 Keys Keyboard Initially on a notepad only one character 'A' is present. You can perform two operations on this notepad for each step: Copy All: You can copy all the characters present on
2018-01-15 10:06:58
321
原创 Leetcode 542. 01 Matrix(BFS)
542. 01 Matrix Given a matrix consists of 0 and 1, find the distance of the nearest 0 for each cell. The distance between two adjacent cells is 1. Example 1: Input: 0 0 0 0 1 0 0 0 0 Out
2018-01-14 23:40:40
469
原创 lintcode-微软笔试
646. 第一个独特字符位置 题目: 给出一个字符串。找到字符串中第一个不重复的字符然后返回它的下标。如果不存在这样的字符,返回 -1。 样例: 给出字符串 s = "lintcode",返回 0。 给出字符串 s = "lovelintcode",返回 2。 思路:简单的hash应用。遍历一次,纪录每个字符出现的次数,再遍历一次,次数大于1的字符就是答案。
2017-12-10 13:43:22
738
原创 量刑辅助系统项目(1)——python删选文件
项目介绍: 对给定的1469900个xml的刑事案件文件进行删选,找出其中道路交通类型的刑事案件。例如根据文件内容找到指定文件,删除其余文件。因为文件数量过于庞大,文件夹有53G,用python脚本筛选。 一、拆分文件夹 由于文件太多,打开文件夹时文件加载太慢,需要二十分钟,.py文件运行时无法读取xml文件。只能把这53G的文件夹拆分成2G的多个文件夹,
2017-10-09 22:55:24
551
原创 hdu 3466 Proud Merchants (01背包 + 结构体的sort排序)
Proud Merchants Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/65536 K (Java/Others) Total Submission(s): 7069 Accepted Submission(s): 2944 Problem Description Recently,
2017-09-12 10:41:34
472
原创 hdu 2546 饭卡 (01背包)
饭卡 Time Limit: 5000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 33150 Accepted Submission(s): 11461 Problem Description 电子科大本部食堂的饭卡有一种很诡异的设计,
2017-09-10 15:46:33
363
原创 BestCoder 度度熊的01世界 (DFS)
度度熊的01世界 Accepts: 967 Submissions: 3064 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Problem Description 度度熊是一个喜欢计算机的孩子,在计算机的
2017-08-12 17:15:26
469
原创 hdu 1864 最大报销额 (01背包)
最大报销额 Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 26372 Accepted Submission(s): 8119 Problem Description 现有一笔经费可以报销一定额度的发票。允
2017-08-11 22:56:52
403
原创 codeforces B. Petya and Exam (模拟)
B. Petya and Exam time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output It's hard times now. Today Petya needs to
2017-07-26 12:14:39
658
原创 leetcode 22. Generate Parentheses
Generate Parentheses Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.For example, given n = 3, a solution set is:[ “((()))”, “(()())”, “(
2017-07-08 15:11:05
358
原创 628. Maximum Product of Three Numbers
628. Maximum Product of Three Numbers Given an integer array, find three numbers whose product is maximum and output the maximum product. Example 1: Input: [1,2,3] Output: 6 Example 2
2017-07-04 17:46:58
383
原创 leetcode 242. Valid Anagram
242. Valid Anagram Given two strings s and t, write a function to determine if t is an anagram of s. For example, s = "anagram", t = "nagaram", return true. s = "rat", t = "car", ret
2017-07-02 16:29:37
346
原创 382. Linked List Random Node (蓄水池抽样,java)
382. Linked List Random Node DescriptionSubmissionsSolutions Total Accepted: 23716Total Submissions: 51037Difficulty: MediumContributor: LeetCode Given a singly linked list, return a
2017-04-10 15:27:57
923
原创 历届试题 剪格子 (DFS,java)
历届试题 剪格子 时间限制:1.0s 内存限制:256.0MB 问题描述 如下图所示,3 x 3 的格子中填写了一些整数。 +--*--+--+ |10* 1|52| +--****--+ |20|30* 1| *******--+ | 1| 2| 3| +--+--+--+ 我们沿着图中的星号线剪开,得到两个部分,每个
2017-04-07 14:30:43
806
原创 FZU Problem 2150 Fire Game (BFS,java)
Problem 2150 Fire Game Accept: 2070 Submit: 7235 Time Limit: 1000 mSec Memory Limit : 32768 KB Problem Description Fat brother and Maze are playing a kind of special (hentai) gam
2017-04-06 13:32:30
571
原创 hdu 5112 A Curious Matt (java,快速输入)
A Curious Matt Time Limit: 2000/2000 MS (Java/Others) Memory Limit: 512000/512000 K (Java/Others) Total Submission(s): 2397 Accepted Submission(s): 1355 Problem Description There is a cu
2017-04-05 13:55:37
543
原创 414. Third Maximum Number (java)
414. Third Maximum Number DescriptionSubmissionsSolutions Total Accepted: 27406Total Submissions: 100537Difficulty: EasyContributors: ZengRed , 1337c0d3r Given a non-empty array
2017-04-03 15:41:14
1031
原创 125. Valid Palindrome (java,)
125. Valid Palindrome DescriptionSubmissionsSolutions Total Accepted: 150777Total Submissions: 585174Difficulty: EasyContributor: LeetCode Given a string, determine if it is a palindr
2017-04-03 15:20:49
648
原创 278. First Bad Version (二分,java)
278. First Bad Version DescriptionSubmissionsSolutions Total Accepted: 90906Total Submissions: 367256Difficulty: EasyContributor: LeetCode You are a product manager and currently lead
2017-04-03 10:07:27
430
原创 204. Count Primes (java)
204. Count Primes DescriptionSubmissionsSolutions Total Accepted: 106085Total Submissions: 403293Difficulty: EasyContributor: LeetCode Description: Count the number of prime nu
2017-04-02 21:16:30
615
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人