11 2016 档案

摘要:Divide two integers without using multiplication, division and mod operator. If it is overflow, return MAX_INT. 1. nagitive 2. overflow Another exampl 阅读全文
posted @ 2016-11-30 09:23 微微程序媛 阅读(138) 评论(0) 推荐(0)
摘要:You are given two jugs with capacities x and y litres. There is an infinite amount of water supply available. You need to determine whether it is poss 阅读全文
posted @ 2016-11-28 12:34 微微程序媛 阅读(405) 评论(0) 推荐(0)
摘要:Given a collection of intervals, find the minimum number of intervals you need to remove to make the rest of the intervals non-overlapping. Note: Exam 阅读全文
posted @ 2016-11-28 12:05 微微程序媛 阅读(370) 评论(0) 推荐(0)
摘要:There are a number of spherical balloons spread in two-dimensional space. For each balloon, provided input is the start and end coordinates of the hor 阅读全文
posted @ 2016-11-28 11:51 微微程序媛 阅读(224) 评论(0) 推荐(0)
摘要:A linked list is given such that each node contains an additional random pointer which could point to any node in the list or null. Return a deep copy 阅读全文
posted @ 2016-11-28 11:13 微微程序媛 阅读(123) 评论(0) 推荐(0)
摘要:Given two numbers represented as strings, return multiplication of the numbers as a string. Note: The numbers can be arbitrarily large and are non-neg 阅读全文
posted @ 2016-11-28 08:21 微微程序媛 阅读(133) 评论(0) 推荐(0)
摘要:Given an integer, write an algorithm to convert it to hexadecimal. For negative integer, two’s complementmethod is used. Note: Example 1: Example 2: 阅读全文
posted @ 2016-11-28 07:41 微微程序媛 阅读(209) 评论(0) 推荐(0)
摘要:Given an unsorted array of integers, find the length of longest increasing subsequence. For example,Given [10, 9, 2, 5, 3, 7, 101, 18],The longest inc 阅读全文
posted @ 2016-11-28 07:23 微微程序媛 阅读(121) 评论(0) 推荐(0)
摘要:Given an 2D board, count how many different battleships are in it. The battleships are represented with 'X's, empty slots are represented with '.'s. Y 阅读全文
posted @ 2016-11-28 06:19 微微程序媛 阅读(220) 评论(0) 推荐(0)
摘要:You are given two linked lists representing two non-negative numbers. The most significant digit comes first and each of their nodes contain a single 阅读全文
posted @ 2016-11-28 05:56 微微程序媛 阅读(275) 评论(0) 推荐(0)
摘要: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 tha 阅读全文
posted @ 2016-11-28 01:28 微微程序媛 阅读(181) 评论(0) 推荐(0)
摘要: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 yo 阅读全文
posted @ 2016-11-28 01:01 微微程序媛 阅读(135) 评论(0) 推荐(0)
摘要:There is a fence with n posts, each post can be painted with one of the k colors. You have to paint all the posts such that no more than two adjacent 阅读全文
posted @ 2016-11-28 00:49 微微程序媛 阅读(375) 评论(0) 推荐(0)
摘要:Given two integers n and k, return all possible combinations of k numbers out of 1 ... n. For example,If n = 4 and k = 2, a solution is: 阅读全文
posted @ 2016-11-28 00:38 微微程序媛 阅读(167) 评论(0) 推荐(0)
摘要: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: You s 阅读全文
posted @ 2016-11-27 14:08 微微程序媛 阅读(177) 评论(0) 推荐(0)
摘要:Given a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numbers from the original list. For example,Given 1->2 阅读全文
posted @ 2016-11-27 13:44 微微程序媛 阅读(140) 评论(0) 推荐(0)
摘要:Follow up for "Remove Duplicates":What if duplicates are allowed at most twice? For example,Given sorted array nums = [1,1,1,2,2,3], Your function sho 阅读全文
posted @ 2016-11-27 13:38 微微程序媛 阅读(98) 评论(0) 推荐(0)
摘要:Given an array of integers A and let n to be its length. Assume Bk to be an array obtained by rotating the array A k positions clock-wise, we define a 阅读全文
posted @ 2016-11-27 11:49 微微程序媛 阅读(268) 评论(0) 推荐(0)
摘要:You are given an n x n 2D matrix representing an image. Rotate the image by 90 degrees (clockwise). Follow up:Could you do this in-place? The idea was 阅读全文
posted @ 2016-11-27 11:11 微微程序媛 阅读(106) 评论(0) 推荐(0)
摘要:Given a non-empty string check if it can be constructed by taking a substring of it and appending multiple copies of the substring together. You may a 阅读全文
posted @ 2016-11-27 08:00 微微程序媛 阅读(750) 评论(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 co 阅读全文
posted @ 2016-11-27 06:57 微微程序媛 阅读(250) 评论(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 @ 2016-11-27 05:43 微微程序媛 阅读(171) 评论(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 extra sp 阅读全文
posted @ 2016-11-26 14:40 微微程序媛 阅读(167) 评论(0) 推荐(0)
摘要:Serialization is the process of converting a data structure or object into a sequence of bits so that it can be stored in a file or memory buffer, or 阅读全文
posted @ 2016-11-26 13:51 微微程序媛 阅读(304) 评论(0) 推荐(0)
摘要:Serialization is the process of converting a data structure or object into a sequence of bits so that it can be stored in a file or memory buffer, or 阅读全文
posted @ 2016-11-26 11:14 微微程序媛 阅读(776) 评论(0) 推荐(0)
摘要:Given a string, sort it in decreasing order based on the frequency of characters. Example 1: Example 2: Example 3: 阅读全文
posted @ 2016-11-26 02:09 微微程序媛 阅读(202) 评论(0) 推荐(0)
摘要:Compare two version numbers version1 and version2.If version1 > version2 return 1, if version1 < version2 return -1, otherwise return 0. You may assum 阅读全文
posted @ 2016-11-25 13:32 微微程序媛 阅读(146) 评论(0) 推荐(0)
摘要:Given n points in the plane that are all pairwise distinct, a "boomerang" is a tuple of points (i, j, k) such that the distance between i and j equals 阅读全文
posted @ 2016-11-25 12:42 微微程序媛 阅读(259) 评论(0) 推荐(0)
摘要:Given an integer n, return the number of trailing zeroes in n!. Note: Your solution should be in logarithmic time complexity. Credits:Special thanks t 阅读全文
posted @ 2016-11-25 07:14 微微程序媛 阅读(99) 评论(0) 推荐(0)
摘要:Given a non-empty integer array of size n, find the minimum number of moves required to make all array elements equal, where a move is incrementing n  阅读全文
posted @ 2016-11-25 01:23 微微程序媛 阅读(295) 评论(0) 推荐(0)
摘要:Assume you are an awesome parent and want to give your children some cookies. But, you should give each child at most one cookie. Each child i has a g 阅读全文
posted @ 2016-11-25 01:04 微微程序媛 阅读(393) 评论(0) 推荐(0)
摘要:Given a sequence of words, check whether it forms a valid word square. A sequence of words forms a valid word square if the kth row and column read th 阅读全文
posted @ 2016-11-24 10:33 微微程序媛 阅读(201) 评论(0) 推荐(0)
摘要:463. Island Perimeter 463. Island Perimeter You are given a map in form of a two-dimensional integer grid where 1 represents land and 0 represents wat 阅读全文
posted @ 2016-11-24 09:51 微微程序媛 阅读(1003) 评论(0) 推荐(0)
摘要:Given a set of candidate numbers (C) and a target number (T), find all unique combinations in C where the candidate numbers sums to T. The same repeat 阅读全文
posted @ 2016-11-17 01:40 微微程序媛 阅读(120) 评论(0) 推荐(0)
摘要:冒泡排序 Bubble Sort O(N^2) 选择排序 select sort 是一种简单直观的排序算法。它的工作原理如下。首先在未排序序列中找到最小(大)元素,存放到排序序列的起始位置,然后,再从剩余未排序元素中继续寻找最小(大)元素,然后放到已排序序列的末尾。以此类推,直到所有元素均排序完毕。 阅读全文
posted @ 2016-11-12 01:53 微微程序媛 阅读(300) 评论(0) 推荐(0)
摘要:1.home page $rails generate controller StaticPages home help 2. test rails test 3. add CSS gem bootstrap-sass in gemfile 或者直接在assert static.scss改 $ to 阅读全文
posted @ 2016-11-07 16:07 微微程序媛 阅读(276) 评论(0) 推荐(0)
摘要:1.安装ruby 和 rails $ rvm use ruby-2.3.0$ gem install rails$ rails --version //run ruby$ irb $ cd workspace$ rails new blog$ rails server //localhost:300 阅读全文
posted @ 2016-11-07 02:24 微微程序媛 阅读(238) 评论(0) 推荐(0)