摘要:
题目: 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 阅读全文
摘要:
题目: 解法: 1. 最容易想到的做法,利用Map记录每个数字出现的次数 class Solution { public int singleNumber(int[] nums) { Map<Integer,Integer> map = new HashMap<>(); for(int i=0;i< 阅读全文
摘要:
题目: You are a product manager and currently leading a team to develop a new product. Unfortunately, the latest version of your product fails the quali 阅读全文
摘要:
题目: 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 阅读全文
摘要:
题目: Given an integer, write a function to determine if it is a power of two. Example 1: Input: 1 Output: true Explanation: 20 = 1 Example 2: Input: 16 阅读全文
摘要:
题目: Implement strStr(). Return the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack. Example 1: Input: hay 阅读全文
摘要:
题目: Given an array nums and a value val, remove all instances of that value in-placeand return the new length. Do not allocate extra space for another 阅读全文
摘要:
题目: Given a sorted array nums, remove the duplicates in-place such that each element appear only once and return the new length. Do not allocate extra 阅读全文
摘要:
题目: Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists. Exam 阅读全文
摘要:
题目: Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid. An input string is valid if 阅读全文