bigpotato

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

2018年3月20日

摘要: You are given an array x of n positive numbers. You start at point (0,0) and moves x[0] metres to the north, then x[1] metres to the west, x[2] metres 阅读全文
posted @ 2018-03-20 11:54 bigpotato 阅读(138) 评论(0) 推荐(0)

摘要: Given an integer, write a function to determine if it is a power of three. Follow up:Could you do it without using any loop / recursion? 判断一个整数是否是3的次方 阅读全文
posted @ 2018-03-20 10:10 bigpotato 阅读(117) 评论(0) 推荐(0)

摘要: There are n bulbs that are initially off. You first turn on all the bulbs. Then, you turn off every second bulb. On the third round, you toggle every 阅读全文
posted @ 2018-03-20 00:27 bigpotato 阅读(127) 评论(0) 推荐(0)

2018年3月19日

摘要: Write a program to find the nth super ugly number. Super ugly numbers are positive numbers whose all prime factors are in the given prime list primes  阅读全文
posted @ 2018-03-19 17:49 bigpotato 阅读(132) 评论(0) 推荐(0)

摘要: Given a positive integer n, find the least number of perfect square numbers (for example, 1, 4, 9, 16, ...) which sum to n. For example, given n = 12, 阅读全文
posted @ 2018-03-19 15:58 bigpotato 阅读(124) 评论(0) 推荐(0)

摘要: Convert a non-negative integer to its english words representation. Given input is guaranteed to be less than 231 - 1. 将非负整数转换为英语表示方式。 分析: 在汉语中计数方式比较简 阅读全文
posted @ 2018-03-19 12:56 bigpotato 阅读(120) 评论(0) 推荐(0)

摘要: Given an array containing n distinct numbers taken from 0, 1, 2, ..., n, find the one that is missing from the array. Note:Your algorithm should run i 阅读全文
posted @ 2018-03-19 09:11 bigpotato 阅读(115) 评论(0) 推荐(0)

摘要: Write a program to find the n-th ugly number. Ugly numbers are positive numbers whose prime factors only include 2, 3, 5. For example, 1, 2, 3, 4, 5, 阅读全文
posted @ 2018-03-19 00:20 bigpotato 阅读(117) 评论(0) 推荐(0)

2018年3月18日

摘要: Write a program to check whether a given number is an ugly number. Ugly numbers are positive numbers whose prime factors only include 2, 3, 5. For exa 阅读全文
posted @ 2018-03-18 17:37 bigpotato 阅读(127) 评论(0) 推荐(0)