摘要:
题目描述:Write an algorithm to determine if a number is "happy".A happy number is a number defined by the following process: Starting with any positive in... 阅读全文
摘要:
题目描述:Write a program to check whether a given number is an ugly number.Ugly numbers are positive numbers whose prime factors only include2, 3, 5. For ... 阅读全文
摘要:
题目描述:Given a sorted linked list, delete all duplicates such that each element appear onlyonce.For example,Given1->1->2, return1->2.Given1->1->2->3->3,... 阅读全文
摘要:
题目描述:You are climbing a stair case. It takesnsteps to reach to the top.Each time you can either climb 1 or 2 steps. In how many distinct ways can you ... 阅读全文
摘要:
题目描述:Reverse a singly linked list.解题思路:使用递归或者迭代的方法。代码如下:方法一:递归/** * Definition for singly-linked list. * public class ListNode { * int val; * ... 阅读全文
摘要:
题目描述:Write a function that takes an unsigned integer and returns the number of ’1' bits it has (also known as theHamming weight).For example, the 32-b... 阅读全文