leetcode 447. Number of Boomerangs
摘要: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 @
2017-08-31 09:18
Beserious
阅读(174)
推荐(0) 编辑
leetcode 523. Continuous Subarray Sum
摘要:Given a list of non-negative numbers and a target integer k, write a function to check if the array has a continuous subarray of size at least 2 that
阅读全文
posted @
2017-08-30 17:48
Beserious
阅读(328)
推荐(1) 编辑
leetcode 30. Substring with Concatenation of All Words
摘要: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 @
2017-08-30 13:20
Beserious
阅读(249)
推荐(0) 编辑
leetcode 667. Beautiful Arrangement II
摘要:Given two integers n and k, you need to construct a list which contains n different positive integers ranging from 1 to n and obeys the following requ
阅读全文
posted @
2017-08-29 16:12
Beserious
阅读(224)
推荐(0) 编辑
leetcode 666. Path Sum IV
摘要:If the depth of a tree is smaller than 5, then this tree can be represented by a list of three-digits integers. For each integer in this list: Given a
阅读全文
posted @
2017-08-28 21:32
Beserious
阅读(364)
推荐(0) 编辑
leetcode 665. Non-decreasing Array
摘要:Given an array with n integers, your task is to check if it could become non-decreasing by modifying at most 1 element. We define an array is non-decr
阅读全文
posted @
2017-08-28 18:23
Beserious
阅读(220)
推荐(0) 编辑
leetcode 85. Maximal Rectangle
摘要:Given a 2D binary matrix filled with 0's and 1's, find the largest rectangle containing only 1's and return its area. For example, given the following
阅读全文
posted @
2017-08-25 22:10
Beserious
阅读(173)
推荐(0) 编辑
leetcode 215. Kth Largest Element in an Array
摘要:Find the kth largest element in an unsorted array. Note that it is the kth largest element in the sorted order, not the kth distinct element. For exam
阅读全文
posted @
2017-08-24 18:20
Beserious
阅读(169)
推荐(0) 编辑
2018华为笔试题
摘要:题目描述 给定一个整数,给出消除重复数字以后最大的整数 输入描述: 正整数,注意考虑长整数 输出描述 消除重复数字后的最大整数 示例1 输入 423234 输出 432 思路分析 :要保存原来的顺序这个题目才有意思,如果不保存原来的顺序,那直接一个set就搞定了。 很明显这个数字的最大长度不会超过2
阅读全文
posted @
2017-08-24 07:56
Beserious
阅读(2369)
推荐(0) 编辑
交错01串
摘要:如果一个01串任意两个相邻位置的字符都是不一样的,我们就叫这个01串为交错01串。例如: "1","10101","0101010"都是交错01串。小易现在有一个01串s,小易想找出一个最长的连续子串,并且这个子串是一个交错01串。小易需要你帮帮忙求出最长的这样的子串的长度是多少。 构造两个交错串然
阅读全文
posted @
2017-08-23 20:20
Beserious
阅读(321)
推荐(0) 编辑
操作序列(网易)
摘要:小易有一个长度为n的整数序列,a_1,...,a_n。然后考虑在一个空序列b上进行n次以下操作:1、将a_i放入b序列的末尾2、逆置b序列小易需要你计算输出操作n次之后的b序列。 恩deque瞎搞
阅读全文
posted @
2017-08-23 20:18
Beserious
阅读(271)
推荐(0) 编辑
2018今日头条笔试(第二题)
摘要:题目描述 给定一个数组序列,需要选出一个区间,使得该区间是所有区间中经过如下计算的值最大的一个。 区间中的最小数 * 区间所有数的和 最后程序输出经过计算后的最大值即可,不需要输出具体的区间。如给定序列[6,2,1]可得到左右可以选定各个区间的计算值: [6]=6*6=36 [2]=2*2=4; [
阅读全文
posted @
2017-08-23 12:04
Beserious
阅读(937)
推荐(0) 编辑
leetcode 567. Permutation in String
摘要:Given two strings s1 and s2, write a function to return true if s2 contains the permutation of s1. In other words, one of the first string's permutati
阅读全文
posted @
2017-08-23 08:02
Beserious
阅读(222)
推荐(0) 编辑
leetcode 417. Pacific Atlantic Water Flow
摘要:Given an m x n matrix of non-negative integers representing the height of each unit cell in a continent, the "Pacific ocean" touches the left and top
阅读全文
posted @
2017-08-22 20:55
Beserious
阅读(300)
推荐(0) 编辑
Lightoj 1166 - Old Sorting
摘要:Given an array containing a permutation of 1 to n, you have to find the minimum number of swaps to sort the array in ascending order. A swap means, yo
阅读全文
posted @
2017-08-21 10:13
Beserious
阅读(173)
推荐(0) 编辑
奶牛问题(链家网)
摘要:题目描述 有N(1<=n<=1000)头奶牛,它们都被标记上一个优先等级编号1,2,3...用来表示它们喝水的优先次序,编号为1的先喝水,编号2的其次。 每天奶牛开始时排成一排,但总是很乱,你要把它们重新排成编号为1的在前,编号为2的其次.... 你能计算出最少需要多少次的交换次序来完成这次重拍吗?
阅读全文
posted @
2017-08-21 09:28
Beserious
阅读(204)
推荐(0) 编辑
leetcode 661. Image Smoother
摘要:Given a 2D integer matrix M representing the gray scale of an image, you need to design a smoother to make the gray scale of each cell becomes the ave
阅读全文
posted @
2017-08-20 12:26
Beserious
阅读(235)
推荐(0) 编辑
leetcode 663. Equal Tree Partition
摘要:Given a binary tree with n nodes, your task is to check if it's possible to partition the tree to two trees which have the equal sum of values after r
阅读全文
posted @
2017-08-20 12:22
Beserious
阅读(301)
推荐(0) 编辑
常用的机器学习&数据挖掘知识点总结
摘要:Basis(基础): MSE(Mean Square Error 均方误差),LMS(LeastMean Square 最小均方),LSM(Least Square Methods 最小二乘法),MLE(MaximumLikelihood Estimation最大似然估计),QP(Quadratic
阅读全文
posted @
2017-08-19 16:25
Beserious
阅读(306)
推荐(0) 编辑
leetcode 211. Add and Search Word - Data structure design
摘要: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 @
2017-08-18 15:41
Beserious
阅读(315)
推荐(0) 编辑
leetcode 349. Intersection of Two Arrays
摘要:Given two arrays, write a function to compute their intersection. Example:Given nums1 = [1, 2, 2, 1], nums2 = [2, 2], return [2]. Note: Each element i
阅读全文
posted @
2017-08-18 08:57
Beserious
阅读(152)
推荐(0) 编辑
leetcode 659. Split Array into Consecutive Subsequences
摘要:You are given an integer array sorted in ascending order (may contain duplicates), you need to split them into several subsequences, where each subseq
阅读全文
posted @
2017-08-17 21:56
Beserious
阅读(1348)
推荐(0) 编辑
leetcode 658. Find K Closest Elements
摘要:Given a sorted array, two integers k and x, find the k closest elements to x in the array. The result should also be sorted in ascending order. If the
阅读全文
posted @
2017-08-16 18:24
Beserious
阅读(200)
推荐(0) 编辑
leetcode 657. Judge Route Circle
摘要:Initially, there is a Robot at position (0, 0). Given a sequence of its moves, judge if this robot makes a circle, which means it moves back to the or
阅读全文
posted @
2017-08-16 18:11
Beserious
阅读(142)
推荐(0) 编辑
leetcode 179. Largest Number
摘要:Given a list of non negative integers, arrange them such that they form the largest number. For example, given [3, 30, 34, 5, 9], the largest formed n
阅读全文
posted @
2017-08-15 17:35
Beserious
阅读(150)
推荐(0) 编辑
leetcode 660. Remove 9
摘要:Start from integer 1, remove any integer that contains 9 such as 9, 19, 29... So now, you will have a new integer sequence: 1, 2, 3, 4, 5, 6, 7, 8, 10
阅读全文
posted @
2017-08-14 09:54
Beserious
阅读(247)
推荐(0) 编辑
leetcode 395. Longest Substring with At Least K Repeating Characters
摘要:Find the length of the longest substring T of a given string (consists of lowercase letters only) such that every character in T appears no less than
阅读全文
posted @
2017-08-11 16:26
Beserious
阅读(133)
推荐(0) 编辑
leetcode 442. Find All Duplicates in an Array
摘要:Given an array of integers, 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and others appear once. Find all the elements that appear twi
阅读全文
posted @
2017-08-10 22:11
Beserious
阅读(167)
推荐(0) 编辑
leetcode 405. Convert a Number to Hexadecimal
摘要:Given an integer, write an algorithm to convert it to hexadecimal. For negative integer, two’s complement method is used. Note: Example 1: Example 2:
阅读全文
posted @
2017-08-08 15:26
Beserious
阅读(153)
推荐(0) 编辑
leetcode 242. Valid Anagram
摘要:Given two strings s and t, write a function to determine if t is an anagram of s. For example,s = "anagram", t = "nagaram", return true.s = "rat", t =
阅读全文
posted @
2017-08-08 11:51
Beserious
阅读(152)
推荐(0) 编辑
leetcode 506. Relative Ranks
摘要:Given scores of N athletes, find their relative ranks and the people with the top three highest scores, who will be awarded medals: "Gold Medal", "Sil
阅读全文
posted @
2017-08-08 10:32
Beserious
阅读(114)
推荐(0) 编辑
leetcode 316. Remove Duplicate Letters
摘要:Given a string which contains only lowercase letters, remove duplicate letters so that every letter appear once and only once. You must make sure your
阅读全文
posted @
2017-08-07 19:31
Beserious
阅读(200)
推荐(0) 编辑
leetcode 654. Maximum Binary Tree
摘要:Given an integer array with no duplicates. A maximum tree building on this array is defined as follow: Construct the maximum tree by the given array a
阅读全文
posted @
2017-08-07 10:33
Beserious
阅读(238)
推荐(0) 编辑
leetcode 653. Two Sum IV - Input is a BST
摘要:Given a Binary Search Tree and a target number, return true if there exist two elements in the BST such that their sum is equal to the given target. E
阅读全文
posted @
2017-08-07 10:30
Beserious
阅读(375)
推荐(0) 编辑
leetcode 656. Coin Path
摘要:Given an array A (index starts at 1) consisting of N integers: A1, A2, ..., AN and an integer B. The integer B denotes that from any place (suppose th
阅读全文
posted @
2017-08-06 22:14
Beserious
阅读(883)
推荐(0) 编辑
leetcode 258. Add Digits
摘要:Given a non-negative integer num, repeatedly add all its digits until the result has only one digit. For example: Given num = 38, the process is like:
阅读全文
posted @
2017-08-06 21:02
Beserious
阅读(133)
推荐(0) 编辑
leetcode 231. Power of Two
摘要:Given an integer, write a function to determine if it is a power of two.
阅读全文
posted @
2017-08-05 22:33
Beserious
阅读(142)
推荐(0) 编辑
B. Flag of Berland
摘要:B. Flag of Berland time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output The flag of Berland is
阅读全文
posted @
2017-08-05 16:49
Beserious
阅读(308)
推荐(0) 编辑
leetcode 400 Add to List 400. Nth Digit
摘要:Find the nth digit of the infinite integer sequence 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, ... Note:n is positive and will fit within the range of a 32-bi
阅读全文
posted @
2017-08-04 22:51
Beserious
阅读(164)
推荐(0) 编辑
leetcode 209. Minimum Size Subarray Sum
摘要: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 @
2017-08-03 18:35
Beserious
阅读(144)
推荐(0) 编辑
Ubuntu 16.04 + github page + hexo 搭建博客
摘要:1. 安装nodejs: sudo apt-get install nodejs-legacy 2.安装nvm : wget -qO- https://raw.github.com/creationix/nvm/master/install.sh | sh 3.nvm安装完成后,重启终端并执行下列命
阅读全文
posted @
2017-08-01 12:43
Beserious
阅读(573)
推荐(0) 编辑