发布了文章2019-02-01
Given a non-empty 2D array grid of 0's and 1's, an island is a group of 1's (representing land) connected 4-directionally (horizontal or vertical.) You may assume all four edges of the grid are surrounded by water. Find the maximum area of an isla...
发布了文章2019-01-24
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 flights, together with starting city src and the destination dst, your task is to find the cheapest price from sr...
发布了文章2018-12-05
Equations are given in the format A / B = k, where A and B are variables represented as strings, and k is a real number (floating point number). Given some queries, return the answers. If the answer does not exist, return -1.0.Example:Given a / b ...
发布了文章2018-11-06
We have a list of bus routes. Each routes[i] is a bus route that the i-th bus repeats forever. For example if routes[0] = [1, 5, 7]`, this means that the first bus (0-th indexed) travels in the sequence 1->5->7->1->5->7->1->.....
发布了文章2018-10-23
A self-dividing number is a number that is divisible by every digit itcontains.For example, 128 is a self-dividing number because 128 % 1 == 0, 128 % 2 == 0, and 128 % 8 == 0. Also, a self-dividing number is not allowed to contain the digit zero. ...
发布了文章2018-04-01
经常使用Javascript的同学一定对setInterval非常熟悉,当使用setInterval(callback, timer)时,每经过timer毫秒时间,系统都将调用一次callback。请问全局如果没有提供setInterval函数,该如何自己实现这一功能?
发布了文章2018-02-24
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, together with starting city src and the destination dst, your task is to find the cheapest price from src...
发布了文章2018-02-21
Remember the story of Little Match Girl? By now, you know exactly whatmatchsticks the little match girl has, please find out a way you canmake one square by using up all those matchsticks. You should notbreak any stick, but you can link them up, a...
发布了文章2018-02-20
Given a non-empty string check if it can be constructed by taking asubstring of it and appending multiple copies of the substringtogether. You may assume the given string consists of lowercaseEnglish letters only and its length will not exceed 100...
发布了文章2018-02-20
Consider the string s to be the infinite wraparound string of"abcdefghijklmnopqrstuvwxyz", so s will look like this:"...zabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcd....".Now we have another string p. Your job is to find out how many u...
发布了文章2015-11-02
给定一个整数数组,要求在数字之间任意添加乘号,加号和括号,使得最后表达式结果最大。比如1121,最大值为(1+1)*(2+1),所有数字都是正数。
发布了文章2015-11-01
现在有一个Tokenizer,返回的Token都是XML标签或者内容,比如(open, html)(inner, hello)(close, html)表示<html>hello</html>,每一个括号及其内容是一个Token,请问如何表示这个XML文件。
发布了文章2015-10-29
给定软件之间安装的依赖关系,用一个二维数组表示,第一维表示依赖的序号,第二维表示依赖关系,比如要先装deps[0][0],才能装deps[0][1]。安装时,要尽可能先安装依赖个数少的软件。求安装顺序。
发布了文章2015-10-29
All DNA is composed of a series of nucleotides abbreviated as A, C, G, and T, for example: "ACGAATTCCG". When studying DNA, it is sometimes useful to identify repeated sequences within the DNA. Write a function to find all the 10-letter-long seque...
发布了文章2015-10-29
Given an array of n positive integers and a positive integer s, find the minimal length of a subarray of which the sum ≥ s. If there isn't one, return 0 instead. For example, given the array [2,3,1,2,4,3] and s = 7, the subarray [4,3] has the mini...
发布了文章2015-10-26
You are given a m x n 2D grid initialized with these three possible values. -1 - A wall or an obstacle. 0 - A gate. INF - Infinity means an empty room. We use the value 231 - 1 = 2147483647 to represent INF as you may assume that the distance to a...
发布了文章2015-10-26
Given a list of words and two words word1 and word2, return the shortest distance between these two words in the list. For example, Assume that words = ["practice", "makes", "perfect", "coding", "makes"]. Given word1 = “coding”, word2 = “practice”...
发布了文章2015-10-26
Given two strings S and T, determine if they are both one edit distance apart.
发布了文章2015-10-25
Given n points on a 2D plane, find the maximum number of points that lie on the same straight line.
发布了文章2015-10-25
Implement regular expression matching with support for '.' and'*'. '.' Matches any single character. '*' Matches zero or more of the preceding element. The matching should cover the entire input string (not partial). The function prototype should ...