![](https://img-blog.csdnimg.cn/20201014180756738.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
力扣
你的人类朋友
慢慢来
展开
-
力扣(LeetCode)之 求两数字之和
**题目描述**代码:class Solution { public int[] twoSum(int[] nums, int target) { int n = nums.length; for(int i = 0; i < n; i++){ for(int j = i + 1; j < n; j++){ if(nums[i] + nums[j] == target)原创 2021-05-06 22:26:10 · 83 阅读 · 0 评论 -
力扣(LeetCode)之回文数
题目:代码:class Solution { public boolean isPalindrome(int x) { if(x < 0|| (x % 10 == 0) && (x != 0)){ return false; } int A = 0; while(x > A){ A = A*10 + x%10; x/=10;原创 2021-04-12 00:30:27 · 707 阅读 · 0 评论 -
【力扣】(LeetCode)刷题之丑数篇
题目:思路:丑数可以被2、3、5整除,1是丑数。可以先把1和小于1的情况先做讨论,再将其余的数多次除以2,3,5最后会得 n==1即表示该数字是丑数。反之不是。class Solution { public boolean isUgly(int n) { if(n <= 1){ return (n == 1)?true:false; } while(n % 2 == 0){ n/=2;原创 2021-04-11 01:26:40 · 155 阅读 · 0 评论