- 博客(47)
- 资源 (1)
- 收藏
- 关注
原创 面试刷题之头条题目一
题目:P为给定的二维平面整数点集。定义 P 中某点x,如果x满足 P 中任意点都不在 x 的右上方区域内(横纵坐标都大于x),则称其为“最大的”。求出所有“最大的”点的集合。(所有点的横坐标和纵坐标都不重复, 坐标轴范围在[0, 1e9) 内)如下图:实心点为满足条件的点的集合。请实现代码找到集合 P 中的所有 ”最大“ 点的集合并输出。输入描述:第一行输入点集的个数 N, 接下来 N ...
2019-02-27 18:51:23 711
原创 leetcode57
题目:Given a set of non-overlapping intervals, insert a new interval into the intervals (merge if necessary).You may assume that the intervals were initially sorted according to their start times. Ex...
2019-02-25 22:33:56 294
原创 leetcode56
题目: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].解法一:这道和之前那道 Insert Interval 很类似,这次题目要求我们合并区间,之前那题...
2019-02-25 22:30:50 439 1
原创 leetcode55
题目: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 position.Determine if ...
2019-02-25 22:27:37 421
原创 leetcode54
题目:Given a matrix of m x n elements (m rows, ncolumns), return all elements of the matrix in spiral order.Example 1:Input:[ [ 1, 2, 3 ], [ 4, 5, 6 ], [ 7, 8, 9 ]]Output: [1,2,3,6,9,8,7,4,5]...
2019-02-25 22:19:57 308
原创 leetcode53
题目: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 subarray [4,−1,2,1] ha...
2019-02-25 22:17:45 380
原创 leetcode52
题目:Follow up for N-Queens problem.Now, instead outputting board configurations, return the total number of distinct solutions.解法:这道题是之前那道 N-Queens N皇后问题 的延伸,说是延伸其实我觉得两者顺序应该颠倒一样,上一道题比这道题还要稍稍复杂一些,两...
2019-02-25 22:12:31 194
原创 leetcode51
题目: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-queens puzzle.Ea...
2019-02-25 22:11:13 254
原创 leetcode50
题目:Implement pow(x, n), which calculates x raised to the power n(xn).Example 1:Input: 2.00000, 10Output: 1024.00000Example 2:Input: 2.10000, 3Output: 9.26100Example 3:Input: 2.00000, -2Out...
2019-02-25 18:08:31 565
原创 leetcode49
题目:Given an array of strings, group anagrams together.Example:Input: ["eat", "tea", "tan", "ate", "nat", "bat"],Output:[ ["ate","eat","tea"], ["nat"
2019-02-25 18:00:04 500
原创 leetcode48
题目: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 the input 2D matrix ...
2019-02-25 17:50:02 271
原创 leetcode47
题目:Given a collection of numbers that might contain duplicates, return all possible unique permutations.Example:Input: [1,1,2]Output:[ [1,1,2], [1,2,1], [2,1,1]]解法一:这道题是之前那道 Permutation...
2019-02-24 23:55:58 364
原创 leetcode46
题目:Given a collection of distinct integers, return all possible permutations.Example:Input: [1,2,3]Output:[ [1,2,3], [1,3,2], [2,1,3], [2,3,1], [3,1,2], [3,2,1]]解法一:这道题是求全排列问题,给的输...
2019-02-24 23:53:16 199
原创 leetcode45
题目: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 position.Your goal is ...
2019-02-24 23:49:59 232
原创 leetcode44
题目:Given an input string (s) and a pattern (p), implement wildcard pattern matching with support for '?' and '*'.'?' Matches any single character.'*' Matches any sequence of characters (including t...
2019-02-24 00:02:20 154
原创 leetcode43
题目:Given two numbers represented as strings, return multiplication of the numbers as a string.Note: The numbers can be arbitrarily large and are non-negative.解法:这道题让我们求两个字符串数字的相乘,输入的两个数和返回的数都是以字符...
2019-02-23 22:59:03 303
原创 leetcode42
题目:Given n non-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.For example, Given [0,1,0,2,1,0,1,3,2,1,2,1]...
2019-02-23 22:57:13 417
原创 leetcode41
题目:Given an unsorted integer array, find the smallest missing positive integer.Example 1:Input: [1,2,0]Output: 3Example 2:Input: [3,4,-1,1]Output: 2Example 3:Input: [7,8,9,11,12]Output: 1...
2019-02-23 22:53:31 182
原创 leetcode40
题目: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 only be used once in the combinat...
2019-02-21 08:43:58 121
原创 leetcode39
题目:Given a set of candidate numbers (candidates) (without duplicates) and a target number (target), find all unique combinations in candidates where the candidate numbers sums to target.The same rep...
2019-02-21 08:39:56 132
原创 leetcode38
题目:The count-and-say sequence is the sequence of integers beginning as follows:1, 11, 21, 1211, 111221, ...1 is read off as "one 1" or 11.11 is read off as "two 1s" or 21.21 is read off as "one 2...
2019-02-21 08:33:17 205
原创 leetcode37
题目:write a program to solve a Sudoku puzzle by filling the empty cells.Empty cells are indicated by the character ‘.’.You may assume that there will be only one unique solution.A sudoku puzzle…...
2019-02-21 08:29:41 354
原创 leetcode36
题目:Determine if a Sudoku is valid, according to: Sudoku Puzzles - The Rules.The Sudoku board could be partially filled, where empty cells are filled with the character ‘.’.A partially filled sudok...
2019-02-21 08:26:12 131
原创 leetcode35
题目:Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order.You may assume no duplicates in the array...
2019-02-20 22:23:43 353
原创 leetcode34
题目:Given a sorted array of integers, find the starting and ending position of a given target value.Your algorithm's runtime complexity must be in the order of O(log n).If the target is not found in...
2019-02-20 22:16:44 466
原创 leetcode33
题目:Suppose a sorted array is rotated at some pivot unknown to you beforehand.(i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2).You are given a target value to search. If found in the array return it...
2019-02-20 22:07:44 76
原创 leetcode32
题目:Given a string containing just the characters '(' and ')', find the length of the longest valid (well-formed) parentheses substring.For "(()", the longest valid parentheses substring is "()", whi...
2019-02-20 22:00:10 92
原创 leetcode31
题目:Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers.If such arrangement is not possible, it must rearrange it as the lowest possib...
2019-02-20 18:37:51 169
原创 leetcode30
题目:You are given a string, s, and a list of words, words, that are all of the same length. Find all starting indices of substring(s) in s that is a concatenation of each word in words exactly once an...
2019-02-20 18:29:32 424
原创 面试刷题之字符串一-翻转句子
题目:输入一个英文句子,翻转句子中单词的顺序,但单词内字符的顺序不变。句子中单词以空格符隔开。为简单起见,标点符号和普通字母一样处理。例如输入“I am a student.”,则输出“student. a am I”。解法一:先用空格将句子分割成单个单词并按顺序存储,然后将这些单词进行反转在这里插入代码片...
2019-02-20 14:09:47 223
原创 leetcode29
题目:Given two integers dividend and divisor, divide two integers without using multiplication, division and mod operator.Return the quotient after dividing dividend by divisor.The integer division...
2019-02-20 08:59:59 110
原创 leetcode28
题目:Implement strStr().Return the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.Example 1:Input: haystack = "hello", needle = "ll"Output: 2Exam...
2019-02-19 21:08:47 98
原创 leetcode27
题目:Given an array nums and a value val, remove all instances of that value in-place and return the new length.Do not allocate extra space for another array, you must do this by modifying the input ...
2019-02-19 21:02:22 227
原创 leetcode26
题目:Given a sorted array nums, 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 by modi...
2019-02-19 20:58:21 620
原创 leetcode25
题目:Given a linked list, reverse the nodes of a linked list k at a time and return its modified list.k is a positive integer and is less than or equal to the length of the linked list. If the number ...
2019-02-19 20:48:16 77
原创 leetcode24
题目:Given a linked list, swap every two adjacent nodes and return its head.You may not modify the values in the list's nodes, only nodes itself may be changed.Example:Given 1->2->3->4, yo...
2019-02-19 16:04:22 130
原创 leetcode23
题目:Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity.Example:Input:[ 1->4->5, 1->3->4, 2->6]Output: 1->1->2->3->...
2019-02-19 15:00:59 170
原创 leetcode22
题目: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:[ "((()))", "(()())", "(())()", "()(())...
2019-02-19 12:36:10 140
原创 leetcode21
题目: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->3->4Output: ...
2019-02-19 09:54:09 119
原创 linux实践(一)补充--配置时可能遇到的问题
这个实验是软微linux内核课程的实验,师兄给了一篇参考的文档,里面有部分遇到问题的解决方案,很实用,所以直接copy师兄的文档。
2019-02-19 09:13:08 161
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人