数据结构&算法
四海八荒一只飞鱼
整理,分享,一起学
展开
-
2018届实习-阿里巴巴内推编程题(简单、清晰)
对于一个由一位十进制整数构成的二叉树,如果深度不超过4,可以用一个三位十进制整数构成的数组表示,具体规则如下:1、百位数表示树的层次L,1<=L<=4;十位数表示在该层次中的位置P,1<=P<=8;个位数表示数值V。2、数组里,L一定是单增的,也就是说后一个数的L大于等于前一个数的L;3、对于同一个L,P也是单增的,就是说在L不变的情况下,后一个数的P大于等于前一个数的P。例如:[ 113, 215原创 2017-04-21 21:17:55 · 1554 阅读 · 0 评论 -
804. Unique Morse Code Words
Java: public int uniqueMorseRepresentations(String[] words) { String[] morse = new String[]{".-","-...","-.-.","-..",".","..-.",&原创 2018-05-28 08:52:53 · 125 阅读 · 0 评论 -
458. Poor Pigs
There are 1000 buckets, one and only one of them contains poison, the rest are filled with water. They all look the same. If a pig drinks that poison it will die within 15 minutes. What is the minimum...原创 2018-05-28 09:26:23 · 210 阅读 · 0 评论 -
819. Most Common Word
Given a paragraph and a list of banned words, return the most frequent word that is not in the list of banned words. It is guaranteed there is at least one word that isn’t banned, and that the answer...原创 2018-05-28 10:08:05 · 210 阅读 · 0 评论 -
788. Rotated Digits
X is a good number if after rotating each digit individually by 180 degrees, we get a valid number that is different from X. Each digit must be rotated - we cannot choose to leave it alone.A number...原创 2018-06-05 09:55:34 · 142 阅读 · 0 评论 -
771. Jewels and Stones
You’re given strings J representing the types of stones that are jewels, and S representing the stones you have. Each character in S is a type of stone you have. You want to know how many of the sto...原创 2018-05-29 09:18:21 · 148 阅读 · 0 评论 -
811. Subdomain Visit Count
A website domain like “discuss.leetcode.com” consists of various subdomains. At the top level, we have “com”, at the next level, we have “leetcode.com”, and at the lowest level, “discuss.leetcode.com”...原创 2018-05-29 09:59:31 · 240 阅读 · 0 评论