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
ARTS #8 Algorithm 本周选择的算法题是:Construct String from Binary Tree 规则如下: You need to construct a string consists of parenthesis and integers from a binary tree with the preorder traversing way. The null nod... 2019-07-277 min read
ARTS #7 Algorithm 本周选择的算法题是:Print Binary Tree 规则如下: Print a binary tree in an m*n 2D string array following these rules: The row number m should be equal to the height of the given binary tree. Th... 2019-07-2112 min read
ARTS #6 Algorithm 本周选择的算法题是:Champagne Tower 规则如下: We stack glasses in a pyramid, where the first row has 1 glass, the second row has 2 glasses, and so on until the 100th row. Each glass holds one cup (... 2019-07-118 min read
ARTS #5 Algorithm 本周选择的算法题是:Vowel Spellchecker 规则如下: Given a wordlist, we want to implement a spellchecker that converts a query word into a correct word. For a given query word, the spell checker hand... 2019-07-0513 min read
ARTS #4 Algorithm 本周选择的算法题是:Sum Root to Leaf Numbers 规则如下: Given a binary tree containing digits from 0-9 only, each root-to-leaf path could represent a number. An example is the root-to-leaf path 1-&g... 2019-06-2710 min read
ARTS #3 Algorithm 本周选择的算法题是:Integer to English Words 规则如下: Convert a non-negative integer to its english words representation. Given input is guaranteed to be less than \(2^{31}-1\). Example 1: Input:... 2019-06-227 min read