首页
题库
公司真题
专项练习
面试题库
在线编程
面试
面试经验
AI 模拟面试
简历
求职
学习
课程
专栏·文章
竞赛
搜索
我要招人
发布职位
发布职位、邀约牛人
更多企业解决方案
在线笔面试、雇主品牌宣传
登录
/
注册
Sawyer_lILi
获赞
4
粉丝
0
关注
0
看过 TA
5
男
上海大学
2020
C++
IP属地:江西
暂未填写个人简介
私信
关注
拉黑
举报
举报
确定要拉黑Sawyer_lILi吗?
发布(29)
刷题
Sawyer_lILi
2023-09-21 10:20
C++
题解 | #记票统计#
import java.util.ArrayList; import java.util.LinkedHashMap; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); while (sc.hasNext()){ int n = sc.nextInt(); LinkedHashMap<String,Int...
0
点赞
评论
收藏
转发
Sawyer_lILi
2023-09-19 10:53
C++
题解 | #字符串字符匹配#
import java.util.Scanner; // 注意类名必须为 Main, 不要有任何 package xxx 信息 public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); while (sc.hasNext()){ String shortStr = sc.nextLine(); String longStr = sc.nextLine(); ...
0
点赞
评论
收藏
转发
Sawyer_lILi
2023-01-23 21:14
C++
题解 | #进制转换#
import java.util.Scanner; // 注意类名必须为 Main, 不要有任何 package xxx 信息 public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); while(sc.hasNext()){ String s = sc.nextLine(); String[] strs = s.split("x"); Stri...
0
点赞
评论
收藏
转发
Sawyer_lILi
2022-12-22 19:24
C++
题解 | #链表中环的入口结点#
/* public class ListNode { int val; ListNode next = null; ListNode(int val) { this.val = val; } } */ import java.util.*; public class Solution { //高赞答案感觉有点炫技,我的答案就是一条路走到底,走一步保存一个节点,重复的那个节点就是环的入口 public ListNode EntryNodeOfLoop(ListNode pHead) { if(pHead.next==nu...
0
点赞
评论
收藏
转发
Sawyer_lILi
2022-12-19 00:37
C++
题解 | #连续子数组的最大和#
public class Solution { public int FindGreatestSumOfSubArray(int[] array) { //dp[i]指array中第i个数字包括在内时array[0-i]中最大的子数组和,因为题目要求的是连续数组的最大和, int[] dp = new int[array.length]; dp[0]=array[0];//初始条件 for(int i=1;i<dp.length;i++){ dp[i]=Math.max(array[i],dp[i-...
0
点赞
评论
收藏
转发
Sawyer_lILi
2022-12-18 20:06
C++
题解 | #顺时针打印矩阵#
import java.util.ArrayList; public class Solution { public ArrayList<Integer> printMatrix(int [][] matrix) { ArrayList<Integer> list = new ArrayList<>(); //特殊情况 if(matrix.length==0){ return list; } int up = 0; int down = matrix.l...
0
点赞
评论
收藏
转发
Sawyer_lILi
2022-12-16 23:15
C++
题解 | #合并两个排序的链表#
/* public class ListNode { int val; ListNode next = null; ListNode(int val) { this.val = val; } }*/ public class Solution { public ListNode Merge(ListNode list1,ListNode list2) { ListNode dummy = new ListNode(0);//设定的头结点,最后return 它的下一个节点 ListNode temp = n...
0
点赞
评论
收藏
转发
Sawyer_lILi
2022-12-16 20:25
C++
题解 | #删除链表的节点#
import java.util.*; /* * public class ListNode { * int val; * ListNode next = null; * public ListNode(int val) { * this.val = val; * } * } */ public class Solution { /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param head ListNode类 * @param v...
0
点赞
评论
收藏
转发
Sawyer_lILi
2022-12-16 19:52
已编辑
C++
题解 | #二进制中1的个数#
public class Solution { public int NumberOf1(int n) { String binNum = Integer.toBinaryString(n); int count = 0; for(int i=0;i<binNum.length();i++){ if(binNum.charAt(i)=='1'){ count++; } } return count; } }
0
点赞
评论
收藏
转发
Sawyer_lILi
2022-12-15 23:02
C++
题解 | #替换空格#
import java.util.*; public class Solution { /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param s string字符串 * @return string字符串 */ public String replaceSpace (String s) { int len = s.length(); StringBuilder sb = new StringBuilder(); ...
0
点赞
评论
收藏
转发
Sawyer_lILi
2022-12-15 22:56
C++
题解 | #数组中重复的数字#
import java.util.*; public class Solution { /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param numbers int整型一维数组 * @return int整型 */ public int duplicate (int[] numbers) { int count = 0; ArrayList<Integer> list = new ArrayList<&...
0
点赞
评论
收藏
转发
Sawyer_lILi
2022-12-15 22:37
已编辑
C++
题解 | #斐波那契数列#
public class Solution {//为什么这个题会只有35%的通过率...... public int Fibonacci(int n) { if(n==1||n==2){ return 1; } else{ return Fibonacci(n-1)+Fibonacci(n-2); } } }
0
点赞
评论
收藏
转发
Sawyer_lILi
2022-12-15 00:33
已编辑
C++
题解 | #自动售货系统#
import java.util.*; //逻辑不难理解,但是能在机考时间内想出来并且实现的可能性不大(对我而言) //死记硬背,默写出来就算成功 public class Main { static ArrayList<Good> goods = new ArrayList<Good>(); static ArrayList<Money> moneys = new ArrayList<Money>(); static int goodTotal; static int moneyTotal; publi...
0
点赞
评论
收藏
转发
Sawyer_lILi
2022-12-14 21:15
C++
题解 | #素数伴侣#
import java.util.*; // 注意类名必须为 Main, 不要有任何 package xxx 信息 public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); while(sc.hasNext()){ int n = sc.nextInt(); int[] nums = new int[n]; for(int i=0;i<n;...
0
点赞
评论
收藏
转发
Sawyer_lILi
2022-12-13 02:13
C++
题解 | #判断两个IP是否属于同一子网#
import java.util.Scanner; // 此类题比较复杂,多写几个函数这样好debug,看上去也清楚一些 public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); while(sc.hasNextLine()){ String mask = sc.nextLine(); String ip1 = sc.nextLine(); St...
0
点赞
评论
收藏
转发
1
2
工具箱
TA的圈子
暂未加入圈子
TA的圈子
TA的笔记
暂无笔记
TA的笔记
登录
0
天
已登录
0
天
连续登录
0
人
今日访客
牛客网
牛客企业服务