自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

Euadvancer的博客

在这里记录下关于技术的点点滴滴

  • 博客(59)
  • 收藏
  • 关注

原创 526. Beautiful Arrangement -Medium

Question Suppose you have N integers from 1 to N. We define a beautiful arrangement as an array that is constructed by these N numbers successfully if one of the following is true for the ith positio

2017-02-23 21:57:09 523

原创 17. Letter Combinations of a Phone Number -Medium

Question Given a digit string, return all possible letter combinations that the number could represent. A mapping of digit to letters (just like on the telephone buttons) is given below.

2017-02-23 20:40:26 578

原创 22. Generate Parentheses -Meidum

Question Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses. 给出一对括号,请你生成所有良好格式的组合(每个开括号后总有一个闭括号对应,比错误示例:“)(”)Example given n = 3, a solutio

2017-02-23 19:48:53 402

原创 40. Combination Sum II -Medium

Question 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 t

2017-02-23 16:07:52 414

原创 39. Combination Sum -Medium

Question 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 repeated number may

2017-02-23 12:56:49 403

原创 47. Permutations II -Medium

Question Given a collection of numbers that might contain duplicates, return all possible unique permutations. 给出一个可能包含重复数字的数组,请你返回所有可能的组合(组合不能重复)Example [1,1,2] have the following unique per

2017-02-23 11:34:57 600

原创 46. Permutations -Medium

Question Given a collection of distinct numbers, return all possible permutations. 给出一个无重复数字的集合,返回所有的组合Example [1,2,3] have the following permutations: [ [1,2,3], [1,3,2], [2

2017-02-23 10:54:20 324

原创 60. Permutation Sequence -Medium

Question 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 (ie, for n = 3): 1. “123”

2017-02-22 22:33:57 379

原创 77. Combinations -Medium

Question Given two integers n and k, return all possible combinations of k numbers out of 1 … n. 给出两个整数n和k,返回所有可能的由K个1…n中的元素的组合Example If n = 4 and k = 2, a solution is: [ [2,4],

2017-02-22 18:28:32 283

原创 78. Subsets -Medium

Question Given a set of distinct integers, nums, return all possible subsets. Note: The solution set must not contain duplicate subsets. 给出一个无重复整数的集合nums,返回所有可能的子集(子集不能重复)Example If nums

2017-02-22 17:53:56 324

原创 79. Word Search -Medium

Question Given a 2D board and a word, find if the word exists in the grid. The word can be constructed from letters of sequentially adjacent cell, where “adjacent” cells are those horizontally o

2017-02-22 17:36:13 289

原创 90. Subsets II -Medium

Question Given a collection of integers that might contain duplicates, nums, return all possible subsets. Note: The solution set must not contain duplicate subsets. 给出一个保护重复数字的整形数组nums,请你返回

2017-02-21 21:14:28 312

原创 93. Restore IP Addresses -Medium

Question Given a string containing only digits, restore it by returning all possible valid IP address combinations. 给出一个仅包含数字的字符串,返回所有可靠的IP的组合Example Given “25525511135”, return [“255.25

2017-02-21 20:09:28 272

原创 131. Palindrome Partitioning -Medium

Question Given a string s, partition s such that every substring of the partition is a palindrome. Return all possible palindrome partitioning of s. 给出一个字符串s,将s分割为回文字串,返回所有的分割方法Example g

2017-02-21 18:53:59 371

原创 216. Combination Sum III -Medium

Question Find all possible combinations of k numbers that add up to a number n, given that only numbers from 1 to 9 can be used and each combination should be a unique set of numbers. 找出K个数字总和为n

2017-02-21 16:31:45 402

原创 401. Binary Watch -Easy

Question A binary watch has 4 LEDs on the top which represent the hours (0-11), and the 6 LEDs on the bottom represent the minutes (0-59). Each LED represents a zero or one, with the least signi

2017-02-20 22:54:55 318

原创 八种常用排序算法总结

总结 稳定排序:冒泡排序,插入排序,归并排序,计数排序,基数排序 不稳定排序:选择排序,快速排序,堆排序 效率上,基于比较的方法中快速排序是最快的方法,平均时间复杂度为O(nlogn),而不基于比较的基数排序的时间复杂度是O(n),虽然它看起来更快,实际上快速排序可以适应更多随机化数据,且占的内存低于基数排序,所以快速排序更流行。交换排序一. 冒泡排序主要思路:它对相邻的两个数进行比

2017-02-17 20:31:40 473 1

原创 70. Climbing Stairs -Easy

Question 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 climb to the top? Note: Given n

2017-02-14 21:09:23 294

原创 121. Best Time to Buy and Sell Stock -Easy

Question Say you have an array for which the ith element is the price of a given stock on day i. If you were only permitted to complete at most one transaction (ie, buy one and sell one share of

2017-02-14 20:17:27 246

原创 303. Range Sum Query - Immutable -Medium

Question Given an integer array nums, find the sum of the elements between indices i and j (i ≤ j), inclusive. Note: 1. You may assume that the array does not change. 2. There are many cal

2017-02-14 11:18:01 224

原创 464. Can I Win -Medium

Question In the “100 game,” two players take turns adding, to a running total, any integer from 1..10. The player who first causes the running total to reach or exceed 100 wins. What if we chang

2017-02-13 22:07:01 511

原创 467. Unique Substrings in Wraparound String -Medium

Question Consider the string s to be the infinite wraparound string of “abcdefghijklmnopqrstuvwxyz”, so s will look like this: “…zabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcd….”. Now

2017-02-13 21:25:40 296

原创 474. Ones and Zeroes -Medium

Question In the computer world, use restricted resource you have to generate maximum benefit is what we always want to pursue. For now, suppose you are a dominator of m 0s and n 1s respectively.

2017-02-13 17:17:51 371

原创 486. Predict the Winner -Medium

Question Given an array of scores that are non-negative integers. Player 1 picks one of the numbers from either end of the array followed by the player 2 and then player 1 and so on. Each time a play

2017-02-13 15:55:59 292

原创 494. Target Sum -Medium

Question 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 one from + and - as its new symbol. Fi

2017-02-13 14:37:00 408

原创 53. Maximum Subarray -Easy

Question Find the contiguous subarray within an array (containing at least one number) which has the largest sum. 找到一个元素总和最大的连续子数组(包含至少一个数字)Example For example, given the array [-2,1,-3,4,-1,

2017-02-12 20:56:32 280

原创 63. Unique Paths II -Medium

Question *Follow up for “Unique Paths”: Now consider if some obstacles are added to the grids. How many unique paths would there be? An obstacle and empty space is marked as 1 and 0 respect

2017-02-12 20:37:14 266

原创 62. Unique Paths -Medium

Question 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 is trying t

2017-02-12 17:30:04 355

原创 64. Minimum Path Sum -Medium

Question 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. Note: You can only move either down

2017-02-12 17:00:17 425

原创 91. Decode Ways -Medium

Question 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, determine the to

2017-02-12 15:43:55 363

原创 95. Unique Binary Search Trees II -Meidum

Question Given an integer n, generate all structurally unique BST’s (binary search trees) that store values 1…n. 给出一个整数n,请你生成所有的不重复的BST的结构(即构建树),它的结点值为1…nExample Given n = 3, your program sho

2017-02-12 14:18:39 250

原创 96. Unique Binary Search Trees -Medium

Question Given n, how many structurally unique BST’s (binary search trees) that store values 1…n? 给出n,可以组成多少个不重复的BST(二叉查找树),其中每个结点的值为1…nExample Given n = 3, there are a total of 5 unique BST’

2017-02-12 11:39:54 246

原创 120. Triangle -Medium

Question Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below. 给出一个三角形,找出从其顶端到底端的最小路径的总和,每次移动是下一行的相邻数字。Example given the

2017-02-12 10:44:58 216

原创 139. Word Break -Medium

Question Given a non-empty string s and a dictionary wordDict containing a list of non-empty words, determine if s can be segmented into a space-separated sequence of one or more dictionary words. Yo

2017-02-11 22:23:51 356

原创 152. Maximum Product Subarray -Medium

Question Find the contiguous subarray within an array (containing at least one number) which has the largest product. 找到一个元素的乘积最大的连续子数组(包含至少一个元素)Example For example, given the array [2,3,-2,4

2017-02-11 20:33:08 274

原创 213. House Robber II -Medium

Question Note: This is an extension of House Robber. After robbing those houses on that street, the thief has found himself a new place for his thievery so that he will not get too much attentio

2017-02-11 17:29:55 310

原创 198. House Robber -Easy

Question You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping you from robbing each of them is that adja

2017-02-11 17:17:34 240

原创 221. Maximal Square -Medium

Question Given a 2D binary matrix filled with 0’s and 1’s, find the largest square containing only 1’s and return its area. 给出一个二维矩阵,元素由0,1组成,找到最大的仅由1组成的正方形,返回其面积大小Example given the following

2017-02-11 15:38:53 306

原创 304. Range Sum Query 2D - Immutable -Medium

Question Given a 2D matrix matrix, find the sum of the elements inside the rectangle defined by its upper left corner (row1, col1) and lower right corner (row2, col2). The above rectangle

2017-02-11 11:46:14 241

原创 309. Best Time to Buy and Sell Stock with Cooldown -Medium

Question Say you have an array for which the ith element is the price of a given stock on day i. Design an algorithm to find the maximum profit. You may complete as many transactions as you like

2017-02-08 22:13:17 254

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除