摘要: Given a positive integer n, find the least number of perfect square numbers (for example, 1, 4, 9, 16, ...) which sum to n. Example 1: Example 2: 阅读全文
posted @ 2019-05-25 13:50 lpomeloz 阅读(354) 评论(0) 推荐(0) 编辑
摘要: Given an array of citations (each citation is a non-negative integer) of a researcher, write a function to compute the researcher's h-index. According 阅读全文
posted @ 2019-05-25 13:39 lpomeloz 阅读(101) 评论(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. Example: Note: 1. 1 is typic 阅读全文
posted @ 2019-05-25 13:29 lpomeloz 阅读(91) 评论(0) 推荐(0) 编辑
摘要: Given an array of numbers nums, in which exactly two elements appear only once and all the other elements appear exactly twice. Find the two elements 阅读全文
posted @ 2019-05-25 13:11 lpomeloz 阅读(103) 评论(0) 推荐(0) 编辑
摘要: Given an Iterator class interface with methods: next() and hasNext(), design and implement a PeekingIterator that support the peek() operation -- it e 阅读全文
posted @ 2019-05-25 13:00 lpomeloz 阅读(171) 评论(0) 推荐(0) 编辑