09 2018 档案

摘要:There is a garden with N slots. In each slot, there is a flower. The N flowers will bloom one by one in N days. In each day, there will be exactly one 阅读全文
posted @ 2018-09-30 07:21 轻风舞动 阅读(746) 评论(0) 推荐(0) 编辑
摘要:Given a time represented in the format "HH:MM", form the next closest time by reusing the current digits. There is no limit on how many times a digit 阅读全文
posted @ 2018-09-30 06:10 轻风舞动 阅读(1737) 评论(0) 推荐(0) 编辑
摘要:Design a logger system that receive stream of messages along with its timestamps, each message should be printed if and only if it is not printed in t 阅读全文
posted @ 2018-09-29 14:29 轻风舞动 阅读(553) 评论(0) 推荐(0) 编辑
摘要:Design a hit counter which counts the number of hits received in the past 5 minutes. Each function accepts a timestamp parameter (in seconds granulari 阅读全文
posted @ 2018-09-29 14:11 轻风舞动 阅读(506) 评论(0) 推荐(0) 编辑
摘要:Given a sorted array of integers nums and integer values a, b and c. Apply a function of the form f(x) = ax2 + bx + c to each element x in the array. 阅读全文
posted @ 2018-09-29 13:42 轻风舞动 阅读(583) 评论(0) 推荐(0) 编辑
摘要:You are given a list of non-negative integers, a1, a2, ..., an, and a target, S. Now you have 2 symbols + and -. For each integer, you should choose o 阅读全文
posted @ 2018-09-29 12:32 轻风舞动 阅读(477) 评论(0) 推荐(0) 编辑
摘要:https://www.interviewbit.com/problems/design-cache/ Features: This is the first part of any system design interview, coming up with the features which 阅读全文
posted @ 2018-09-29 08:46 轻风舞动 阅读(555) 评论(0) 推荐(0) 编辑
摘要:You're now a baseball game point recorder. Given a list of strings, each string can be one of the 4 following types: Each round's operation is permane 阅读全文
posted @ 2018-09-29 08:02 轻风舞动 阅读(247) 评论(0) 推荐(0) 编辑
摘要:Given an unsorted array of integers, find the length of longest continuous increasing subsequence (subarray). Example 1: Example 2: Note: Length of th 阅读全文
posted @ 2018-09-29 07:15 轻风舞动 阅读(382) 评论(0) 推荐(0) 编辑
摘要:Given an unsorted array of integers, find the number of longest increasing subsequence. Example 1: Example 2: Note: Length of the given array will be 阅读全文
posted @ 2018-09-29 06:05 轻风舞动 阅读(459) 评论(0) 推荐(0) 编辑
摘要:In a N x N grid representing a field of cherries, each cell is one of three possible integers. 0 means the cell is empty, so you can pass through; 1 m 阅读全文
posted @ 2018-09-29 03:31 轻风舞动 阅读(820) 评论(0) 推荐(0) 编辑
摘要:Given a bench with n seats and few people sitting, tell the seat number each time when a new person goes to sit on the bench such that his distance fr 阅读全文
posted @ 2018-09-27 09:10 轻风舞动 阅读(289) 评论(0) 推荐(0) 编辑
摘要:You are given a map in form of a two-dimensional integer grid where 1 represents land and 0 represents water. Grid cells are connected horizontally/ve 阅读全文
posted @ 2018-09-27 06:23 轻风舞动 阅读(356) 评论(0) 推荐(0) 编辑
摘要:这篇文章翻译自http://www.thegeekstuff.com/2010/11/50-linux-commands/这些都是一些很常用的命令,这篇文章中每个命令都有一些简单的示例说明它的用法,对于想学习Unix/Linux的人,这些命令基本上都是需要掌握的: 1. tar 创建一个新的tar文 阅读全文
posted @ 2018-09-26 08:28 轻风舞动 阅读(259) 评论(0) 推荐(0) 编辑
摘要:HashMap和Hashtable的比较是Java面试中的常见问题,用来考验程序员是否能够正确使用集合类以及是否可以随机应变使用多种思路解决问题。HashMap的工作原理、ArrayList与Vector的比较以及这个问题是有关Java 集合框架的最经典的问题。Hashtable是个过时的集合类,存 阅读全文
posted @ 2018-09-26 08:24 轻风舞动 阅读(195) 评论(0) 推荐(0) 编辑
摘要:Given a binary tree, flatten it to a linked list in-place. For example, given the following tree: The flattened tree should look like: 给一个二叉树,把它展平为链表  阅读全文
posted @ 2018-09-25 13:40 轻风舞动 阅读(495) 评论(0) 推荐(0) 编辑
摘要:Given m arrays, and each array is sorted in ascending order. Now you can pick up two integers from two different arrays (each array picks one) and cal 阅读全文
posted @ 2018-09-25 13:26 轻风舞动 阅读(798) 评论(0) 推荐(0) 编辑
摘要:In social network like Facebook or Twitter, people send friend requests and accept others' requests as well. Table request_accepted holds the data of 阅读全文
posted @ 2018-09-25 13:03 轻风舞动 阅读(1350) 评论(0) 推荐(0) 编辑
摘要:In social network like Facebook or Twitter, people send friend requests and accept others’ requests as well. Now given two tables as below: Table: fri 阅读全文
posted @ 2018-09-25 12:55 轻风舞动 阅读(1582) 评论(0) 推荐(0) 编辑
摘要:Select all employee's name and bonus whose bonus is < 1000. Table:Employee Table: Bonus Example ouput: 选出所有奖金<1000元的雇员姓名及奖金数额 解法1: 解法2: All LeetCode Q 阅读全文
posted @ 2018-09-25 12:43 轻风舞动 阅读(1229) 评论(0) 推荐(1) 编辑
摘要:The Employee table holds all employees including their managers. Every employee has an Id, and there is also a column for the manager Id. Given the Em 阅读全文
posted @ 2018-09-25 12:34 轻风舞动 阅读(836) 评论(0) 推荐(0) 编辑
摘要:Let's play the minesweeper game (Wikipedia, online game)! You are given a 2D char matrix representing the game board. 'M' represents an unrevealed min 阅读全文
posted @ 2018-09-24 10:06 轻风舞动 阅读(1277) 评论(0) 推荐(0) 编辑
摘要:Objective: Given ‘N’ windows where each window contains certain number of tickets at each window. Price of a ticket is equal to number of tickets rema 阅读全文
posted @ 2018-09-23 16:23 轻风舞动 阅读(450) 评论(0) 推荐(0) 编辑
摘要:Given two sparse matrices A and B, return the result of AB. You may assume that A's column number is equal to B's row number. Example: 给2个稀疏矩阵,返回矩阵相乘的 阅读全文
posted @ 2018-09-23 15:32 轻风舞动 阅读(1846) 评论(0) 推荐(0) 编辑
摘要:In a given array nums of positive integers, find three non-overlapping subarrays with maximum sum. Each subarray will be of size k, and we want to max 阅读全文
posted @ 2018-09-23 14:36 轻风舞动 阅读(604) 评论(0) 推荐(0) 编辑
摘要:A frog is crossing a river. The river is divided into x units and at each unit there may or may not exist a stone. The frog can jump on a stone, but i 阅读全文
posted @ 2018-09-23 08:07 轻风舞动 阅读(1292) 评论(0) 推荐(0) 编辑
摘要:Given an array A (index starts at 1) consisting of N integers: A1, A2, ..., AN and an integer B. The integer Bdenotes that from any place (suppose the 阅读全文
posted @ 2018-09-23 07:55 轻风舞动 阅读(895) 评论(0) 推荐(0) 编辑
摘要:Given a binary tree where all the right nodes are either leaf nodes with a sibling (a left node that shares the same parent node) or empty, flip it up 阅读全文
posted @ 2018-09-22 12:33 轻风舞动 阅读(1115) 评论(0) 推荐(0) 编辑
摘要: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 阅读全文
posted @ 2018-09-21 09:45 轻风舞动 阅读(399) 评论(0) 推荐(0) 编辑
摘要:Given a linked list, rotate the list to the right by k places, where k is non-negative. Example 1: Example 2: 与189. Rotate Array 类似,但链表不能通过index来访问,要一 阅读全文
posted @ 2018-09-21 09:37 轻风舞动 阅读(393) 评论(0) 推荐(0) 编辑
摘要: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 the 阅读全文
posted @ 2018-09-21 09:15 轻风舞动 阅读(494) 评论(0) 推荐(0) 编辑
摘要: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 阅读全文
posted @ 2018-09-21 09:09 轻风舞动 阅读(754) 评论(0) 推荐(1) 编辑
摘要:Validate if a given string can be interpreted as a decimal number. Some examples:"0" => true" 0.1 " => true"abc" => false"1 a" => false"2e10" => true" 阅读全文
posted @ 2018-09-21 08:59 轻风舞动 阅读(586) 评论(0) 推荐(0) 编辑
摘要:Given a string containing only digits, restore it by returning all possible valid IP address combinations. Example: 解法:Backtracking Java: Java: Java: 阅读全文
posted @ 2018-09-21 08:18 轻风舞动 阅读(494) 评论(0) 推荐(0) 编辑
摘要:Given a binary tree, determine if it is a valid binary search tree (BST). Assume a BST is defined as follows: The left subtree of a node contains only 阅读全文
posted @ 2018-09-21 05:09 轻风舞动 阅读(619) 评论(0) 推荐(0) 编辑
摘要:Add a third dimension of time to a hashmap , so ur hashmap will look something like this - HashMap<K, t, V> where t is a float value. Implement the ge 阅读全文
posted @ 2018-09-21 01:59 轻风舞动 阅读(163) 评论(0) 推荐(0) 编辑
摘要:Given an array of numbers nums, in which exactly two elements appear only once and all the other elements appear exactly twice. Find the two elements 阅读全文
posted @ 2018-09-20 14:52 轻风舞动 阅读(900) 评论(0) 推荐(1) 编辑
摘要:Given a non-empty array of integers, every element appears three times except for one, which appears exactly once. Find that single one. Note: Your al 阅读全文
posted @ 2018-09-20 14:46 轻风舞动 阅读(521) 评论(0) 推荐(0) 编辑
摘要:Given a non-empty array of integers, every element appears twice except for one. Find that single one. Note: Your algorithm should have a linear runti 阅读全文
posted @ 2018-09-20 13:55 轻风舞动 阅读(522) 评论(0) 推荐(0) 编辑
摘要:The gray code is a binary numeral system where two successive values differ in only one bit. Given a non-negative integer n representing the total num 阅读全文
posted @ 2018-09-20 08:39 轻风舞动 阅读(357) 评论(0) 推荐(0) 编辑
摘要:Given an array of n positive integers and a positive integer s, find the minimal length of a contiguous subarray of which the sum ≥ s. If there isn't 阅读全文
posted @ 2018-09-20 08:21 轻风舞动 阅读(462) 评论(0) 推荐(0) 编辑
摘要:Design a data structure that supports the following two operations: search(word) can search a literal word or a regular expression string containing o 阅读全文
posted @ 2018-09-20 05:19 轻风舞动 阅读(358) 评论(0) 推荐(0) 编辑
摘要:Given an integer array nums, find the contiguous subarray within an array (containing at least one number) which has the largest product. Example 1: E 阅读全文
posted @ 2018-09-20 04:09 轻风舞动 阅读(501) 评论(0) 推荐(0) 编辑
摘要: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 conca 阅读全文
posted @ 2018-09-18 09:23 轻风舞动 阅读(389) 评论(0) 推荐(0) 编辑
摘要:原题目:Search for a Range, 现在题目改为: 34. Find First and Last Position of Element in Sorted Array Given an array of integers nums sorted in ascending order, 阅读全文
posted @ 2018-09-18 09:03 轻风舞动 阅读(434) 评论(0) 推荐(0) 编辑
摘要:Write a program to solve a Sudoku puzzle by filling the empty cells. A sudoku solution must satisfy all of the following rules: Empty cells are indica 阅读全文
posted @ 2018-09-18 08:40 轻风舞动 阅读(432) 评论(0) 推荐(0) 编辑
摘要:You are playing the following Flip Game with your friend: Given a string that contains only these two characters: + and -, you and your friend take tu 阅读全文
posted @ 2018-09-18 08:27 轻风舞动 阅读(1465) 评论(0) 推荐(0) 编辑
摘要:You are playing the following Flip Game with your friend: Given a string that contains only these two characters: + and -, you and your friend take tu 阅读全文
posted @ 2018-09-18 08:14 轻风舞动 阅读(819) 评论(0) 推荐(0) 编辑
摘要:Given an array with n integers, you need to find if there are triplets (i, j, k) which satisfies following conditions: where we define that subarray ( 阅读全文
posted @ 2018-09-18 06:35 轻风舞动 阅读(1336) 评论(0) 推荐(0) 编辑
摘要:Given a picture consisting of black and white pixels, and a positive integer N, find the number of black pixels located at some specific row R and col 阅读全文
posted @ 2018-09-18 03:43 轻风舞动 阅读(872) 评论(0) 推荐(0) 编辑
摘要:Given a picture consisting of black and white pixels, find the number of black lonely pixels. The picture is represented by a 2D char array consisting 阅读全文
posted @ 2018-09-18 03:37 轻风舞动 阅读(1398) 评论(1) 推荐(0) 编辑
摘要:Given two strings s and t, determine if they are isomorphic. Two strings are isomorphic if the characters in s can be replaced to get t. All occurrenc 阅读全文
posted @ 2018-09-18 01:51 轻风舞动 阅读(991) 评论(0) 推荐(0) 编辑
摘要:Given an Android 3x3 key lock screen and two integers m and n, where 1 ≤ m ≤ n ≤ 9, count the total number of unlock patterns of the Android lock scre 阅读全文
posted @ 2018-09-16 14:53 轻风舞动 阅读(569) 评论(0) 推荐(0) 编辑
摘要:其中list()函数与tuple()函数接受可抚今迭代的对象(比如一个序列)作为参数,并通过浅拷贝数据来创建一个新的列表与元组.虽然字符串也是序列类型,但一般它们不用于list()与tuple().更多的情况下,它们用于在两种类型之间进行轩换,比如你需要把一个已有的元组转换成列表类型(然后你可以修改 阅读全文
posted @ 2018-09-16 08:55 轻风舞动 阅读(2736) 评论(0) 推荐(0) 编辑
摘要:https://www.hackerrank.com/challenges/minimum-swaps-2/problem Minimum Swaps II You are given an unordered array consisting of consecutive integers [1, 阅读全文
posted @ 2018-09-15 13:50 轻风舞动 阅读(1209) 评论(0) 推荐(0) 编辑
摘要:外排序 通常来说,外排序处理的数据不能一次装入内存,只能放在读写较慢的外存储器(通常是硬盘)上。外排序通常采用的是一种“排序-归并”的策略。在排序阶段,先读入能放在内存中的数据量,将其排序输出到一个临时文件,依此进行,将待排序数据组织为多个有序的临时文件。之后在归并阶段将这些临时文件组合为一个大的有 阅读全文
posted @ 2018-09-15 13:34 轻风舞动 阅读(3724) 评论(0) 推荐(0) 编辑
摘要:How would you remove duplicate lines from a file that is much too large to fit in memory? The duplicate lines are not necessarily adjacent, and say th 阅读全文
posted @ 2018-09-15 13:22 轻风舞动 阅读(457) 评论(0) 推荐(0) 编辑
摘要:有编号1~100个灯泡,起初所有的灯都是灭的。有100个同学来按灯泡开关,如果灯是亮的,那么按过开关之后,灯会灭掉。如果灯是灭的,按过开关之后灯会亮。 现在开始按开关。 第1个同学,把所有的灯泡开关都按一次(按开关灯的编号: 1,2,3,......100)。第2个同学,隔一个灯按一次(按开关灯的编 阅读全文
posted @ 2018-09-15 13:05 轻风舞动 阅读(1372) 评论(0) 推荐(0) 编辑
摘要:Given a non-negative number represented as a singly linked list of digits, plus one to the number. The digits are stored such that the most significan 阅读全文
posted @ 2018-09-15 07:14 轻风舞动 阅读(513) 评论(0) 推荐(0) 编辑
摘要:Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST. For this problem, a height-balanced bina 阅读全文
posted @ 2018-09-15 06:54 轻风舞动 阅读(720) 评论(0) 推荐(0) 编辑
摘要:Given an array where elements are sorted in ascending order, convert it to a height balanced BST. For this problem, a height-balanced binary tree is d 阅读全文
posted @ 2018-09-15 06:46 轻风舞动 阅读(518) 评论(0) 推荐(0) 编辑
摘要:Given a paragraph and a list of banned words, return the most frequent word that is not in the list of banned words. It is guaranteed there is at leas 阅读全文
posted @ 2018-09-15 06:23 轻风舞动 阅读(795) 评论(0) 推荐(0) 编辑
摘要:Design a Tic-tac-toe game that is played between two players on a n x n grid. You may assume the following rules: A move is guaranteed to be valid and 阅读全文
posted @ 2018-09-15 04:35 轻风舞动 阅读(1097) 评论(0) 推荐(0) 编辑
摘要: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. Y 阅读全文
posted @ 2018-09-14 15:23 轻风舞动 阅读(211) 评论(0) 推荐(0) 编辑
摘要: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 maxim 阅读全文
posted @ 2018-09-13 15:30 轻风舞动 阅读(484) 评论(0) 推荐(0) 编辑
摘要: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 maxim 阅读全文
posted @ 2018-09-13 15:24 轻风舞动 阅读(458) 评论(0) 推荐(0) 编辑
摘要:Given a sorted integer array nums, where the range of elements are in the inclusive range [lower, upper], return its missing ranges. Example: Java: Ja 阅读全文
posted @ 2018-09-13 14:49 轻风舞动 阅读(1250) 评论(0) 推荐(0) 编辑
摘要:Given a sorted integer array without duplicates, return the summary of its ranges. Example 1: Example 2: Java: Python: Python: Python: C++: C++: 类似题目: 阅读全文
posted @ 2018-09-13 14:38 轻风舞动 阅读(818) 评论(0) 推荐(0) 编辑
摘要:Write a program that outputs the string representation of numbers from 1 to n. But for multiples of three it should output “Fizz” instead of the numbe 阅读全文
posted @ 2018-09-12 10:42 轻风舞动 阅读(439) 评论(0) 推荐(0) 编辑
摘要:LeetCode Top Interview Questions https://leetcode.com/problemset/top-interview-questions/ 阅读全文
posted @ 2018-09-12 09:25 轻风舞动 阅读(1173) 评论(0) 推荐(0) 编辑
摘要:Given a string s, partition s such that every substring of the partition is a palindrome. Return all possible palindrome partitioning of s. Example: 解 阅读全文
posted @ 2018-09-11 15:15 轻风舞动 阅读(908) 评论(0) 推荐(0) 编辑
摘要:Given an array of n distinct non-empty strings, you need to generate minimal possible abbreviations for every word following rules below. Example: Not 阅读全文
posted @ 2018-09-11 03:32 轻风舞动 阅读(1187) 评论(0) 推荐(0) 编辑
摘要:The count-and-say sequence is the sequence of integers with the first five terms as following: 1 is read off as "one 1" or 11.11 is read off as "two 1 阅读全文
posted @ 2018-09-11 02:57 轻风舞动 阅读(679) 评论(0) 推荐(0) 编辑
摘要:LeetCode wants to give one of its best employees the option to travel among N cities to collect algorithm problems. But all work and no play makes Jac 阅读全文
posted @ 2018-09-10 11:55 轻风舞动 阅读(767) 评论(0) 推荐(0) 编辑
摘要:During the NBA playoffs, we always arrange the rather strong team to play with the rather weak team, like make the rank 1 team play with the rank nth  阅读全文
posted @ 2018-09-10 09:17 轻风舞动 阅读(1067) 评论(0) 推荐(0) 编辑
摘要:There are n cities connected by m flights. Each fight starts from city u and arrives at v with a price w. Now given all the cities and fights, togethe 阅读全文
posted @ 2018-09-09 14:55 轻风舞动 阅读(1157) 评论(0) 推荐(0) 编辑
摘要:Given a string that contains only digits 0-9 and a target value, return all possibilities to add binary operators (not unary) +, -, or *between the di 阅读全文
posted @ 2018-09-08 13:48 轻风舞动 阅读(872) 评论(0) 推荐(0) 编辑
摘要:Your are given an array of integers prices, for which the i-th element is the price of a given stock on day i; and a non-negative integer fee represen 阅读全文
posted @ 2018-09-08 08:04 轻风舞动 阅读(727) 评论(0) 推荐(0) 编辑
摘要:Given a non-empty array of non-negative integers nums, the degree of this array is defined as the maximum frequency of any one of its elements. Your t 阅读全文
posted @ 2018-09-08 06:33 轻风舞动 阅读(453) 评论(0) 推荐(0) 编辑
只有注册用户登录后才能阅读该文。
posted @ 2018-09-08 03:22 轻风舞动 阅读(2) 评论(0) 推荐(0) 编辑
只有注册用户登录后才能阅读该文。
posted @ 2018-09-07 13:43 轻风舞动 阅读(2) 评论(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-07 04:39 轻风舞动 阅读(448) 评论(0) 推荐(0) 编辑
摘要:An abbreviation of a word follows the form <first letter><number><last letter>. Below are some examples of word abbreviations: Assume you have a dicti 阅读全文
posted @ 2018-09-07 04:05 轻风舞动 阅读(945) 评论(0) 推荐(0) 编辑
摘要:Given an array nums containing n + 1 integers where each integer is between 1 and n (inclusive), prove that at least one duplicate number must exist. 阅读全文
posted @ 2018-09-07 02:49 轻风舞动 阅读(454) 评论(0) 推荐(0) 编辑
摘要:Given two arrays, write a function to compute their intersection. Example 1: Input: nums1 = [1,2,2,1], nums2 = [2,2] Output: [2,2] Example 2: Input: n 阅读全文
posted @ 2018-09-04 14:22 轻风舞动 阅读(562) 评论(0) 推荐(0) 编辑
摘要:Given two arrays, write a function to compute their intersection. Example 1: Example 2: Input: nums1 = [4,9,5], nums2 = [9,4,9,8,4] Output: [9,4] Exam 阅读全文
posted @ 2018-09-04 14:00 轻风舞动 阅读(794) 评论(0) 推荐(0) 编辑
摘要:For a undirected graph with tree characteristics, we can choose any node as the root. The result graph is then a rooted tree. Among all possible roote 阅读全文
posted @ 2018-09-04 13:07 轻风舞动 阅读(733) 评论(0) 推荐(0) 编辑
摘要:Given a binary tree, find all leaves and then remove those leaves. Then repeat the previous steps until the tree is empty. Example:Given binary tree R 阅读全文
posted @ 2018-09-04 12:52 轻风舞动 阅读(636) 评论(0) 推荐(0) 编辑
摘要:Given a binary tree, return the values of its boundary in anti-clockwise direction starting from root. Boundary includes left boundary, leaves, and ri 阅读全文
posted @ 2018-09-04 12:40 轻风舞动 阅读(1392) 评论(0) 推荐(1) 编辑
摘要:Given an unsorted integer array, find the smallest missing positive integer. Example 1: Example 2: Example 3: Note: Your algorithm should run in O(n) 阅读全文
posted @ 2018-09-04 08:06 轻风舞动 阅读(243) 评论(0) 推荐(0) 编辑
摘要:A virus is spreading rapidly, and your task is to quarantine the infected area by installing walls. The world is modeled as a 2-D array of cells, wher 阅读全文
posted @ 2018-09-04 07:03 轻风舞动 阅读(639) 评论(0) 推荐(0) 编辑
摘要:We have a grid of 1s and 0s; the 1s in a cell represent bricks. A brick will not drop if and only if it is directly connected to the top of the grid, 阅读全文
posted @ 2018-09-03 08:16 轻风舞动 阅读(903) 评论(0) 推荐(0) 编辑
摘要:We have two integer sequences A and B of the same non-zero length. We are allowed to swap elements A[i] and B[i]. Note that both elements are in the s 阅读全文
posted @ 2018-09-03 06:14 轻风舞动 阅读(677) 评论(0) 推荐(0) 编辑
摘要:Given a non-negative integer, you could swap two digits at most once to get the maximum valued number. Return the maximum valued number you could get. 阅读全文
posted @ 2018-09-03 05:34 轻风舞动 阅读(1072) 评论(0) 推荐(0) 编辑
摘要:假设数组是从小到大排序,数值可能为负数、0、正数。 思路一 可以一次性遍历一遍,找出绝对值最小值,此时时间复杂度为O(N),缺点是没有利用数组是有序的这一特点。 思路二 数组有序,可以利用二分查找的特性。中间的数是正数,往后找;中间的数是负数,往前找。 问题的本质是找到正数的最小值,或负数的最大值, 阅读全文
posted @ 2018-09-03 04:25 轻风舞动 阅读(536) 评论(0) 推荐(0) 编辑
摘要:Given two strings s1, s2, find the lowest ASCII sum of deleted characters to make two strings equal. Example 1: Example 2: Note: 0 < s1.length, s2.len 阅读全文
posted @ 2018-09-02 16:30 轻风舞动 阅读(470) 评论(0) 推荐(0) 编辑
摘要:Given two words word1 and word2, find the minimum number of steps required to make word1 and word2 the same, where in each step you can delete one cha 阅读全文
posted @ 2018-09-02 16:16 轻风舞动 阅读(517) 评论(0) 推荐(0) 编辑
摘要:Sort a linked list in O(n log n) time using constant space complexity. Example 1: Example 2: 给一个链表排序,要求Time: O(nlogn), constant space complexity. 解法:1 阅读全文
posted @ 2018-09-02 04:34 轻风舞动 阅读(214) 评论(0) 推荐(0) 编辑
摘要:[LeetCode] Top 100 Liked Questions All LeetCode Questions List 题目汇总 阅读全文
posted @ 2018-09-02 04:24 轻风舞动 阅读(822) 评论(0) 推荐(0) 编辑

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