摘要:
package com.example.myapplication; import androidx.appcompat.app.AppCompatActivity; import android.content.ContentValues; import android.database.sqli 阅读全文
posted @ 2023-11-09 21:18
超爱彬宝同学
阅读(18)
评论(0)
推荐(0)
摘要:
/** * https://leetcode.cn/problems/find-peak-element/description/ * 由于数组的两个端点前后都是负无穷,所以给定一个i如果arr[i]>arr[i+1]说明在[0,i]这个区间里面一定有个峰值 * 反之则在[i,n]之间 * 以此使用 阅读全文
posted @ 2023-11-09 08:51
超爱彬宝同学
阅读(8)
评论(0)
推荐(0)
摘要:
StringBuilder类是Java中用于处理可变字符串的类,它提供了许多常用的函数来进行字符串的操作。以下是StringBuilder常用函数的示例: append(String str):将指定的字符串追加到当前字符串的末尾。 StringBuilder sb = new StringBuil 阅读全文
posted @ 2023-11-09 08:51
超爱彬宝同学
阅读(26)
评论(0)
推荐(0)
摘要:
public static void fun(){ Scanner sc=new Scanner(System.in); String n=sc.next(); StringBuilder sb=new StringBuilder(n); sb.reverse(); n=sb.toString(); 阅读全文
posted @ 2023-11-09 08:51
超爱彬宝同学
阅读(10)
评论(0)
推荐(0)
摘要:
/** * https://leetcode.cn/problems/search-in-rotated-sorted-array/description/ * 找到旋转的点 * 判断target的值是在旋转点的那一边 * 在在这个区间内使用二分查找 * */ public static void 阅读全文
posted @ 2023-11-09 08:51
超爱彬宝同学
阅读(8)
评论(0)
推荐(0)
摘要:
/** * https://leetcode.cn/problems/search-a-2d-matrix/description/ * * @return*/ public static boolean hanShu3(int[][] matrix, int target){ int m = ma 阅读全文
posted @ 2023-11-09 08:51
超爱彬宝同学
阅读(27)
评论(0)
推荐(0)
摘要:
/** * https://www.nowcoder.com/practice/acead2f4c28c401889915da98ecdc6bf * * 本题采用前缀和的思想(用来快速的得到数组某一段区间里的值的和) * 首先录入数组arr * 创建一个dp数组用来存放数组的前缀和 * dp[i]就 阅读全文
posted @ 2023-11-09 08:50
超爱彬宝同学
阅读(14)
评论(0)
推荐(0)
摘要:
/** * https://leetcode.cn/problems/subarray-sums-divisible-by-k/description/ * 1.同余定理:如果(a-b)/p=k k为整数,则a%p=b%p * 2.C++和Java中对[负数%正数]的结果以及修正: * 负%正=负 阅读全文
posted @ 2023-11-09 08:50
超爱彬宝同学
阅读(13)
评论(0)
推荐(0)