- 博客(25)
- 收藏
- 关注
原创 【MySQL】牛客网数据库编程80题刷题记录
题库:https://www.nowcoder.com/activity/oj?tab=1题目不写了,直接写代码和解题思路。SQL1 查找最晚入职员工的所有信息可以利用分页,但是最晚的记录不一定只有一个,所以用子查询先查到最晚的时间,外查询找到入职时间是最晚时间的所有员工。SELECT * FROM employeesWHERE hire_date = (SELECT MAX(hire_date) FROM employees)SQL2查找入职员工时间排名倒数第三的员工所有信息.
2021-08-18 21:36:18
772
原创 【java】leetcode刷题记录+简单思路(hot100+剑指offer 简单\中等难度)
避免重复刷题每次都两眼一抹黑咩都不记得,简单记一下思路。1. 两数之和(简单)2. 两数相加(中等)3. 无重复字符的最长子串(中等)4. 寻找两个正序数组的中位数(困难)5. 最长回文子串(中等)10. 正则表达式匹配(困难)11. 盛最多水的容器(中等)15. 三数之和(中等)17. 电话号码的字母组合(中等)19. 删除链表的倒数第 N 个结点(中等)...
2021-08-14 18:06:08
1500
1
原创 【java】随机生成体彩大乐透号码(指定区间内多个不重复的随机数)
跟同学买彩票看完开奖后的摸鱼。大乐透的格式为前区5个整数,取值范围1-35,后区2个整数,取值范围1-12,且同区间内不能重复。其实要解决的也就是不重复的问题。一开始的思路是用哈希,或者和取值范围等长的数组,取出后标记该位是否被取过。但问题就是要一直随机直到找到没有取过的数字。所以最后用了链表,取出来了删掉即可。public class bighappytou { public static int[] get(){ int[] re = new int[7];
2021-07-14 21:35:24
3078
原创 【剑指offer】面试题29:顺时针打印矩阵(JAVA)
package sword;/*输入一个矩阵,按照从外向里以顺时针的顺序依次打印出每一个数字。* */import java.util.Arrays;/** * @author PangWanjia * @date 2021/4/13 19:40 */public class test29 { public static int[] spiralOrder(int[][] matrix) { int row = matrix.length; .
2021-04-13 20:23:50
187
原创 【剑指offer】面试题7:重建二叉树(JAVA)
package sword;// 题目:输入某二叉树的前序遍历和中序遍历的结果,请重建出该二叉树。假设输// 入的前序遍历和中序遍历的结果中都不含重复的数字。例如输入前序遍历序列{1,// 2, 4, 7, 3, 5, 6, 8}和中序遍历序列{4, 7, 2, 1, 5, 3, 8, 6},则重建出// 二叉树并输出它的头结点。class TreeNode { int val; TreeNode left; TreeNode right; TreeNode.
2021-03-30 21:43:14
160
原创 【剑指offer】面试题5:替换空格(JAVA)
/*请实现一个函数,把字符串 s 中的每个空格替换成"%20"。*//** * 1.在原有的字符串上进行替换 * 2.创建新字符串进行替换 */package sword;/** * @author PangWanjia * @date 2021/3/25 20:21 */public class test05 { //在原有的空间上替换,先遍历计算空格数量,得到需扩展的数组大小。然后从后向前移动。 public static StringBuffer replac.
2021-03-25 21:11:33
148
原创 【剑指offer】面试题4:二维数组中的查找(JAVA)
/** * 在一个 n * m 的二维数组中,每一行都按照从左到右递增的顺序排序,每一列都按照从上到下递增的顺序排序。 * 请完成一个高效的函数,输入这样的一个二维数组和一个整数,判断数组中是否含有该整数。 */package sword;/** * @author PangWanjia * @date 2021/3/23 21:27 */public class test04 { public static boolean findNumberIn2DArray(int[].
2021-03-25 20:18:22
133
原创 【剑指offer】面试题3:数组中重复的数字(JAVA)
/**在一个长度为n的数组里的所有数字都在0到n-1的范围内。数组中某些数字是重复的,但不知道有几个数字重复了,也不知道每个数字重复了几次。请找出数组中任意一个重复的数字。例如,如果输入长度为7的数组{2, 3, 1, 0, 2, 5, 3},那么对应的输出是重复的数字2或者3。*//*思路: * 1.将数组排序,排序后看邻近 * 2.哈希,将下标与数值对应,在排表的过程中发现重复元素即返回 *//** * 拓展:不修改数组的查找 * 在一个长度为n+1的数组里的所有数字都在1到n.
2021-03-23 22:00:14
145
原创 【人头分类器训练】python+opencv实现视频人头识别
参考教程:https://blog.youkuaiyun.com/MR_Peach07/article/details/74093800【准备】Python 2.7.13opencv 3.4.1opencv的训练器在参考教程中有分享【过程】1、建立文件夹如下:data中用于存放生成的pos.vec(开始为空)data1存放分类器文件(开始为空)posdata和negdata...
2020-11-04 16:56:11
1109
1
原创 【数据结构】线性表:顺序表、单链表、双链表、单循环链表、双循环链表(java实现)
目录顺序表单链表双链表单循环链表双循环链表总结顺序表package com.list;import java.lang.*;import java.util.*;/** * @author PangWanjia * @date 2020/11/3 14:50 *//*顺序表和java的ArrayList类创建顺序表,顺序表的增删查改都是通过下标和容量实现的*/class SqListClass<E>{ ..
2020-11-04 16:46:27
983
原创 杭电oj-1003 Max Sum
Problem DescriptionGiven a sequence a[1],a[2],a[3]......a[n], your job is to calculate the max sum of a sub-sequence. For example, given (6,-1,5,4,-7), the max sum in this sequence is 6 + (-1) + 5 +...
2018-09-16 10:48:47
340
原创 杭电oj-1002 A + B Problem II
Problem DescriptionI have a very simple problem for you. Given two integers A and B, your job is to calculate the Sum of A + B.InputThe first line of the input contains an integer T(1<=T&l...
2018-09-16 10:15:09
2866
原创 北大oj-1002 487-3279
DescriptionBusinesses like to have memorable telephone numbers. One way to make a telephone number memorable is to have it spell a memorable word or phrase. For example, you can call the University ...
2018-09-15 10:33:31
742
原创 PAT-甲级-1020 Tree Traversals
1020 Tree Traversals (25)(25 分)Suppose that all the keys in a binary tree are distinct positive integers. Given the postorder and inorder traversal sequences, you are supposed to output the level or...
2018-08-15 22:18:49
207
原创 PAT-甲级-1019 General Palindromic Number
1019 General Palindromic Number (20)(20 分)A number that will be the same when it is written forwards or backwards is known as a Palindromic Number. For example, 1234321 is a palindromic number. All ...
2018-08-10 00:03:42
210
原创 PAT-甲级-1015 Reversible Primes
1015 Reversible Primes (20)(20 分)A reversible prime in any number system is a prime whose "reverse" in that number system is also a prime. For example in the decimal system 73 is a reversible prime ...
2018-08-09 18:04:09
434
原创 PAT-甲级-1012 The Best Rank
1012 The Best Rank (25)(25 分)To evaluate the performance of our first year CS majored students, we consider their grades of three courses only: C - C Programming Language, M - Mathematics (Calculus ...
2018-08-09 13:31:55
312
原创 PAT-甲级-1011 World Cup Betting
1011 World Cup Betting (20)(20 分)With the 2010 FIFA World Cup running, football fans the world over were becoming increasingly excited as the best players from the best teams doing battles for the W...
2018-08-09 01:16:52
150
原创 PAT-甲级-1009 Product of Polynomials
1009 Product of Polynomials (25)(25 分)This time, you are supposed to find A*B where A and B are two polynomials.Input Specification:Each input file contains one test case. Each case occupies 2 l...
2018-08-09 00:01:06
393
原创 PAT-甲级-1008 Elevator
1008 Elevator (20)(20 分)The highest building in our city has only one elevator. A request list is made up with N positive numbers. The numbers denote at which floors the elevator will stop, in speci...
2018-08-08 20:15:42
201
原创 PAT-甲级-1007 Maximum Subsequence Sum
1007 Maximum Subsequence Sum (25)(25 分)Given a sequence of K integers { N~1~, N~2~, ..., N~K~ }. A continuous subsequence is defined to be { N~i~, N~i+1~, ..., N~j~ } where 1 <= i <= j <= K...
2018-08-05 23:14:47
897
原创 PAT-甲级-1006 Sign In and Sign Out
1006 Sign In and Sign Out (25)(25 分)At the beginning of every day, the first person who signs in the computer room will unlock the door, and the last one who signs out will lock the door. Given the ...
2018-08-05 22:21:09
242
原创 PAT-甲级-1005 Spell It Right
1005 Spell It Right (20)(20 分)Given a non-negative integer N, your task is to compute the sum of all the digits of N, and output every digit of the sum in English.Input Specification:Each input ...
2018-08-05 22:17:42
268
原创 PAT-甲级-1002 A+B for Polynomials
题目1002 A+B for Polynomials (25)(25 分)This time, you are supposed to find A+B where A and B are two polynomials.InputEach input file contains one test case. Each case occupies 2 lines, and each...
2018-07-27 19:43:06
757
原创 PAT-甲级-1001 A+B Format
题目1001 A+B Format (20)(20 分)Calculate a + b and output the sum in standard format -- that is, the digits must be separated into groups of three by commas (unless there are less than four digits)....
2018-07-27 19:31:32
247
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人