09 2018 档案

摘要:题目一 permutations 题目描述 Given a collection of numbers, return all possible permutations. For example,[1,2,3]have the following permutations:[1,2,3],[1,3 阅读全文
posted @ 2018-09-17 23:45 鸭子船长 阅读(246) 评论(0) 推荐(0) 编辑
摘要: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 阅读全文
posted @ 2018-09-17 23:15 鸭子船长 阅读(980) 评论(0) 推荐(0) 编辑
摘要:单链表的特点是:单向。设头结点位head,则最后一个节点的next指向NULL。如果只知道头结点head,请问怎么将该链表排序? 设结点结构为 struct Node{ int key; Node* next; }; 那么一般人见到这种题目,立马就会想到指针交换。是的,大家被指针交换的题目做多了,形 阅读全文
posted @ 2018-09-17 23:01 鸭子船长 阅读(405) 评论(0) 推荐(0) 编辑
摘要:[LeetCode] Anagrams Given an array of strings, return all groups of strings that are anagrams. Note: All inputs will be in lower-case. 思路: Anagrams指几个 阅读全文
posted @ 2018-09-15 23:37 鸭子船长 阅读(250) 评论(0) 推荐(0) 编辑
摘要:题目描述 Implement pow(x, n). AC: class Solution { public: double pow(double x, int n) { if(x == 0 && n == 0) return 1; if(x == 0) return 0; if(n == 0) re 阅读全文
posted @ 2018-09-15 23:25 鸭子船长 阅读(229) 评论(0) 推荐(0) 编辑
摘要: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, re 阅读全文
posted @ 2018-09-15 23:10 鸭子船长 阅读(296) 评论(0) 推荐(0) 编辑
摘要: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 阅读全文
posted @ 2018-09-13 23:16 鸭子船长 阅读(332) 评论(0) 推荐(0) 编辑
摘要:I: 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 ma 阅读全文
posted @ 2018-09-13 22:47 鸭子船长 阅读(200) 评论(0) 推荐(0) 编辑
摘要: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]. 合并有重叠的区间,且原区 阅读全文
posted @ 2018-09-13 22:35 鸭子船长 阅读(287) 评论(0) 推荐(0) 编辑
摘要:Given a set of non-overlapping intervals, insert a new interval into the intervals (merge if necessary). You may assume that the intervals were initia 阅读全文
posted @ 2018-09-13 22:23 鸭子船长 阅读(159) 评论(0) 推荐(0) 编辑
摘要:1 基本解释:extern可以置于变量或者函数前,以标示变量或者函数的定义在别的文件中,提示编译器遇到此变量和函数时在其他模块中寻找其定义。此外extern也可用来进行链接指定。 也就是说extern有两个作用,第一个,当它与"C"一起连用时,如: extern "C" void fun(int a 阅读全文
posted @ 2018-09-13 16:16 鸭子船长 阅读(261) 评论(0) 推荐(0) 编辑
摘要: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 阅读全文
posted @ 2018-09-13 00:10 鸭子船长 阅读(256) 评论(0) 推荐(0) 编辑
摘要:I: Given a matrix of m x n elements (m rows, n columns), return all elements of the matrix in spiral order. For example,Given the following matrix: Yo 阅读全文
posted @ 2018-09-13 00:03 鸭子船长 阅读(251) 评论(0) 推荐(0) 编辑
摘要:The set [1,2,3,…,n] contains a total of n! unique permutations. By listing and labeling all of the permutations in order,We get the following sequence 阅读全文
posted @ 2018-09-12 23:41 鸭子船长 阅读(142) 评论(0) 推荐(0) 编辑
摘要:Given a list, rotate the list to the right by k places, where k is non-negative. For example:Given1->2->3->4->5->NULLand k =2,return4->5->1->2->3->NUL 阅读全文
posted @ 2018-09-12 23:16 鸭子船长 阅读(122) 评论(0) 推荐(0) 编辑
摘要: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 p 阅读全文
posted @ 2018-09-12 23:03 鸭子船长 阅读(168) 评论(0) 推荐(0) 编辑
摘要:Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right which minimizes the sum of all numbers along its path. 阅读全文
posted @ 2018-09-12 21:54 鸭子船长 阅读(114) 评论(0) 推荐(0) 编辑
摘要: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. 合并两个有序链表 阅读全文
posted @ 2018-09-11 23:48 鸭子船长 阅读(160) 评论(0) 推荐(0) 编辑
摘要:Given two binary strings, return their sum (also a binary string). For example,a ="11"b ="1"Return"100". 阅读全文
posted @ 2018-09-11 23:12 鸭子船长 阅读(442) 评论(0) 推荐(0) 编辑
摘要:Validate if a given string is numeric. Some examples:"0" => true" 0.1 " => true"abc" => false"1 a" => false"2e10" => true Note: It is intended for the 阅读全文
posted @ 2018-09-11 23:01 鸭子船长 阅读(601) 评论(0) 推荐(0) 编辑
摘要: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 a 阅读全文
posted @ 2018-09-11 22:40 鸭子船长 阅读(145) 评论(0) 推荐(0) 编辑
摘要:Given an array of words and a length L, format the text such that each line has exactly L characters and is fully (left and right) justified. You shou 阅读全文
posted @ 2018-09-11 22:29 鸭子船长 阅读(202) 评论(0) 推荐(0) 编辑
摘要:Implementint sqrt(int x). Compute and return the square root of x. 逐次逼近 阅读全文
posted @ 2018-09-11 22:15 鸭子船长 阅读(154) 评论(0) 推荐(0) 编辑
摘要:You are climbing a stair case. It takes n steps to reach to the top. Each time you can either climb 1 or 2 steps. In how many distinct ways can you cl 阅读全文
posted @ 2018-09-11 22:05 鸭子船长 阅读(244) 评论(0) 推荐(0) 编辑
摘要:题目描述 Given an absolute path for a file (Unix-style), simplify it. For example,path ="/home/", =>"/home"path ="/a/./b/../../c/", =>"/c" click to show c 阅读全文
posted @ 2018-09-11 21:48 鸭子船长 阅读(333) 评论(0) 推荐(0) 编辑
摘要:Given two words word1 and word2, find the minimum number of steps required to convert word1 to word2. (each operation is counted as 1 step.) You have 阅读全文
posted @ 2018-09-11 21:34 鸭子船长 阅读(240) 评论(0) 推荐(0) 编辑
摘要:题目描述 Given a m x n matrix, 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 ext 阅读全文
posted @ 2018-09-11 21:07 鸭子船长 阅读(193) 评论(0) 推荐(0) 编辑

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