-
每周一算法2018.02.09
Can Place Flowers Suppose you have a long flowerbed in which some of the plots are planted and some are not. However, flowers cannot be planted in adjacent plots - they would compete for water and both would die. Given a flowerbed (represented as …
-
每周一算法2018.02.02
Given an integer array, you need to find one continuous subarray that if you only sort this subarray in ascending order, then the whole array will be sorted in ascending order, too. You need to find the shortest such subarray and output its length…
-
每周一算法2018.01.26
Average of Levels in Binary Tree SGiven a non-empty binary tree, return the average value of the nodes on each level in the form of an array. Example 1: Input: Output: [3, 14.5, 11] Explanation: The average value of nodes on level 0 is 3, on …
-
每周一算法2018.01.19
Fizz Buzz Write a program that outputs the string representation of numbers from 1 to n. But for multiples of three it should output “Fizz” instead of the number and for the multiples of five output “Buzz”. For numbers which are multiples of both…
-
大道至简 -> 汇编语言(二)
作者:少聪 github &&掘金 寄存器 、 通用寄存器以及字在寄存器中的存储 CPU 是运算器、控制器、寄存器(CPU工作原理)等器件构成,靠内部总线链接 运算器进行信息处理 寄存器进行信息存储 控制器控制各种器件进行工作 内部总线连接各种器件,在它们之间进行数据传送 不同的 CPU 寄存器的个数、结构是不相同的。 比如 8086CPU 有 14个寄存器 : AX、BX、CX、DX、SI、DI、SP、BP、IP、CS、SS、DS、ES、PSW。 通用寄存器 8086CPU 的…
-
每周一算法2018.01.12
Arranging Coins You have a total of n coins that you want to form in a staircase shape, where every k-th row must have exactly k coins. Given n, find the total number of full staircase rows that can be formed. n is a non-negative integer and fit…
-
每周一算法2018.01.05
Longest Palindrome Given a string which consists of lowercase or uppercase letters, find the length of the longest palindromes that can be built with those letters. This is case sensitive, for example "Aa" is not considered a palindrome here. Note…