ARTS #16 Algorithm 本周选择的算法题是:Longest Common Prefix 规则如下: Write a function to find the longest common prefix string amongst an array of strings. If there is no common prefix, return an empty string "". ... 2019-09-214 min read
ARTS #15 Algorithm 本周选择的算法题是:Palindrome Number 规则如下: Determine whether an integer is a palindrome. An integer is a palindrome when it reads the same backward as forward. Example 1: Input: 121 Output: t... 2019-09-145 min read
ARTS #14 Algorithm 本周选择的算法题是:Max Points on a Line 规则如下: Given n points on a 2D plane, find the maximum number of points that lie on the same straight line. Example 1: Input: [[1,1],[2,2],[3,3]] Output:... 2019-09-074 min read
ARTS #13 Algorithm 本周选择的算法题是:Range Sum Query - Immutable 规则如下: Given an integer array nums, find the sum of the elements between indices i and j (i ≤ j), inclusive. Example: Given nums = [-2, 0, 3, -5,... 2019-08-313 min read
ARTS #12 Algorithm 本周选择的算法题是:Contains Duplicate III 规则如下: Given an array of integers, find out whether there are two distinct indices i and j in the array such that the absolutedifference between nums[i]... 2019-08-244 min read
ARTS #11 Algorithm 本周选择的算法题是:Global and Local Inversions 规则如下: We have some permutation A of [0, 1, ..., N - 1], where N is the length of A. The number of (global) inversions is the number of i < j w... 2019-08-174 min read
ARTS #10 Algorithm 本周选择的算法题是:Longest Palindromic Substring 规则如下: Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000. Example 1: Input: "b... 2019-08-108 min read
Manacher 从字符串 babadada 中找出最长回文子串:adada。 暴力破解的方式略过。一种优化后的方法是: 在循环遍历的过程中从中心往两边拓展来找回文子串 用一个集合记录每个索引的回文长度 具体过程如下: i = 1 lengths = [0, 0, 0, 0, 0, 0, 0, 0] babadada ^ i lengths[i] = 1 -------------... 2019-08-075 min read
ARTS #9 Algorithm 本周选择的算法题是:Longest Increasing Subsequence 规则如下: Given an unsorted array of integers, find the length of longest increasing subsequence. Example: Input: [10,9,2,5,3,7,101,18] Output: 4... 2019-08-0312 min read
The most important skill a programmer can learn Originally published at https://huseyinpolatyuruk.com. No, no, no, no, and no. And no. A big NO. Clear as that. All you have to do is to bring those two-letters together and say it. Now, ... 2019-08-034 min read