摘要: 题目: 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 阅读全文
posted @ 2020-04-02 20:34 好麻烦快点 阅读(114) 评论(0) 推荐(0) 编辑
摘要: 题目: 解法: 1. 最容易想到的做法,利用Map记录每个数字出现的次数 class Solution { public int singleNumber(int[] nums) { Map<Integer,Integer> map = new HashMap<>(); for(int i=0;i< 阅读全文
posted @ 2020-04-01 21:17 好麻烦快点 阅读(80) 评论(0) 推荐(0) 编辑
摘要: 题目: 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 阅读全文
posted @ 2020-03-27 21:46 好麻烦快点 阅读(105) 评论(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 阅读全文
posted @ 2020-03-27 19:12 好麻烦快点 阅读(89) 评论(0) 推荐(0) 编辑
摘要: 题目: 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 阅读全文
posted @ 2020-03-26 22:25 好麻烦快点 阅读(146) 评论(0) 推荐(0) 编辑
摘要: 题目: 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 阅读全文
posted @ 2020-03-19 17:21 好麻烦快点 阅读(94) 评论(0) 推荐(0) 编辑
摘要: 题目: 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 阅读全文
posted @ 2020-03-19 17:16 好麻烦快点 阅读(80) 评论(0) 推荐(0) 编辑
摘要: 题目: 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 阅读全文
posted @ 2020-03-19 17:13 好麻烦快点 阅读(116) 评论(0) 推荐(0) 编辑
摘要: 题目: 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 阅读全文
posted @ 2020-03-19 17:06 好麻烦快点 阅读(79) 评论(0) 推荐(0) 编辑
摘要: 题目: Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid. An input string is valid if 阅读全文
posted @ 2020-03-19 17:02 好麻烦快点 阅读(84) 评论(0) 推荐(0) 编辑