摘要: 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 阅读全文
posted @ 2018-06-04 21:30 小飞侠war 阅读(99) 评论(0) 推荐(0) 编辑
摘要: A rectangle is represented as a list [x1, y1, x2, y2], where (x1, y1) are the coordinates of its bottom-left corner, and (x2, y2) are the coordinates 阅读全文
posted @ 2018-06-01 00:51 小飞侠war 阅读(148) 评论(0) 推荐(0) 编辑
摘要: Given two non-negative integers num1 and num2 represented as string, return the sum of num1 and num2. Note: The length of both num1 and num2 is < 5100 阅读全文
posted @ 2018-06-01 00:38 小飞侠war 阅读(96) 评论(0) 推荐(0) 编辑
摘要: Given a non-negative integer num, repeatedly add all its digits until the result has only one digit. Example: Input: 38 Output: 2 Explanation: The pro 阅读全文
posted @ 2018-05-30 01:10 小飞侠war 阅读(98) 评论(0) 推荐(0) 编辑
摘要: Given two binary strings, return their sum (also a binary string). The input strings are both non-empty and contains only characters 1 or 0. Example 1 阅读全文
posted @ 2018-05-28 21:25 小飞侠war 阅读(207) 评论(0) 推荐(0) 编辑
摘要: We have two special characters. The first character can be represented by one bit 0. The second character can be represented by two bits (10 or 11). N 阅读全文
posted @ 2018-05-23 21:39 小飞侠war 阅读(107) 评论(0) 推荐(0) 编辑
摘要: 问题描述 约瑟夫问题:有n只猴子,按顺时针方向围成一圈选大王(编号从1到n),从第1号开始报数,一直数到m,数到m的猴子退出圈外,剩下的猴子再接着从1开始报数。就这样,直到圈内只剩下一只猴子时,这个猴子就是猴王,编程求输入n,m后,输出最后猴王的编号。 输入 每行是用空格分开的两个整数,第一个是 n 阅读全文
posted @ 2017-11-27 17:10 小飞侠war 阅读(177) 评论(0) 推荐(0) 编辑