- 博客(146)
- 资源 (3)
- 收藏
- 关注
原创 面试算法题-平衡点问题
平衡点问题题目简单遍历删掉元素加减比较题目平衡点问题: 一个数组中的元素,如果其前面的部分等于后面的部分,那么这个点的位序就是平衡点。 比如列表numbers = [1, 3, 5, 7, 8, 25, 4, 20],25前面的总和为24,25,后面的总和也是24,那么25就是这个列表的平衡点。 要求编写程序,寻找并返回任意一个列表的平衡点。简单遍历遍历第二个元素至倒数第二个元素,分别计算该元素的左半部分的和与右半部分的和,如果左半部分的和等于右半部分的和,则返回该元素。# 遍历数组时间复
2020-08-03 21:05:28 982
原创 【leetcode】-231. Power of Two 2的指数
Power of Two题目位运算Java题目Given an integer, write a function to determine if it is a power of two.Example 1:Input: 1Output: trueExplanation: 20 = 1Example 2:Input: 16Output: trueExplanation: 24 = 16Example 3:Input: 218Output: false位运算【leetcode】
2020-07-28 15:59:33 332
原创 【leetcode】-191. Number of 1 Bits 数字二进制表示1的个数
Number of 1 Bits题目n&(n-1)Java题目Write a function that takes an unsigned integer and return the number of ‘1’ bits it has (also known as the Hamming weight).Example 1:Input: 00000000000000000000000000001011Output: 3Explanation: The input binary str
2020-07-28 15:50:13 360
原创 【leetcode】-1. Two Sum 两数和
Two Sum题目哈希表题目Given an array of integers, return indices of the two numbers such that they add up to a specific target.You may assume that each input would have exactly one solution, and you may not use the same element twice.Example:Given nums = [2,
2020-07-28 15:34:31 257
原创 【leetcode】-22. Generate Parentheses生成括号
Generate Parentheses题目回溯+剪枝python代码题目Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.For example, given n = 3, a solution set is:[“((()))”,“(()())”,“(())()”,“()(())”,“()()()”]输入一个数字n,看有多少种匹配
2020-07-27 11:18:44 224
原创 【leetcode】-37. Sudoku Solver 解数独
Sudoku Solver题目回溯Java代码题目Write a program to solve a Sudoku puzzle by filling the empty cells.A sudoku solution must satisfy all of the following rules:Each of the digits 1-9 must occur exactly once in each row.Each of the digits 1-9 must occur exactly
2020-07-26 23:56:25 216
原创 【面经】度小满 测试研发工程师 一面二面面经
视频面试一面:37分钟自我介绍是今年的毕业生,之前没找工作吗,现在找工作的原因挑一个项目经历讲一下给用户展示的代码是怎么写的怎么理解进程跟线程,二者的区别是什么用过多进程吗,脚本语言有涉及到进程list跟set有什么区别Linux常用的命令,自己使用过的命令对文本的一些命令用过吗,vi,vim这种。mysql用得怎么样订单表id,amount,取出金额top10的产品。(给提示:一个产品有多条申购记录)有一个带logo的纸杯,怎么对它进行测试。(给提示,比如说杯子的材料,耐热耐冷,
2020-07-26 17:44:46 1413
原创 【leetcode】-225. Implement Stack using Queues 用队列实现栈
Implement Stack using Queues题目队列实现栈Java代码python代码题目Implement the following operations of a stack using queues.push(x) – Push element x onto stack.pop() – Removes the element on top of the stack.top() – Get the top element.empty() – Return whether the
2020-07-24 23:07:24 165
原创 【leetcode】-232. Implement Queue using Stacks 用栈实现队列
Implement Queue using Stacks题目两栈底重合组成队列Java代码python 代码题目Implement the following operations of a queue using stacks.push(x) – Push element x to the back of queue.pop() – Removes the element from in front of queue.peek() – Get the front element.empty()
2020-07-24 21:46:48 204
原创 【leetcode】-92. Reverse Linked List II 反转部分链表II python版
反转部分链表题目递归法python 代码题目Reverse a linked list from position m to n. Do it in one-pass.Note: 1 ≤ m ≤ n ≤ length of list.Example:Input: 1->2->3->4->5->NULL, m = 2, n = 4Output: 1->4->3->2->5->NULL递归法1、首先递归写出反转全部链表;2、然后在1基
2020-07-24 00:41:01 146
原创 【leetcode】- 239. Sliding Window Maximum滑动窗口最大值 python版
滑动窗口最大值题目单调队列python代码题目Given an array nums, there is a sliding window of size k which is moving from the very left of the array to the very right. You can only see the k numbers in the window. Each time the sliding window moves right by one position. Ret
2020-07-24 00:07:27 243
原创 【剑指offer】--反转链表 python版
反转链表题目描述头插法python代码题目描述输入一个链表,反转链表后,输出新链表的表头。头插法如果头结点不为空,那么遍历头结点。首先用一个指针记录后面的结点,防止链表断开。然后将头结点指向空,用一个指针记录指向空结点的指针,这是已经反转的部分。最后使遍历结点回到防断开的链表结点。python代码需要注意的是,如果不是在特定的编辑器练习代码,是需要自己定义链表结点的,有时候面试实在会想不起来,将链表结点定义为一个类,然后进行初始化。# class ListNode:# def _
2020-07-23 16:11:10 113
原创 【面经】广发银行软件开发岗面经
自我介绍是更看重软件开发岗位还是广发银行是金融行业对于工作中有任务没有负责人的情况怎么处理工作中会经常出现一个工作产品也不管,开发也不管,测试也不管的情况,在这种环境下你个人的优点和不足分别是什么这两个项目经历是实习还是毕业设计讲项目的功能、用的技术、怎么去做的会对接支付吗购物车管理怎么实现的购物车跟用户的关系,是一对多的关系吗数据库的设计,用户和数据库的设计,字段的设计用户和购物车的关联关系,怎么关联的每个表里面有建立主键和组合索引吗,建主键和组合索引的目的是什么组合索引是唯一索引
2020-07-23 12:52:46 1800
原创 【面经】Java后端开发面试
做一下自我介绍讲一下java集合,回答中有提到hashset,hashmaphashset与hashmap的区别为什么synchronized修饰就是线程安全的有了解线程相关问题吗,讲一下线程池,说一下对线程池的理解线程池的参数有哪些线程池有哪些,有用到哪些线程池知道springcloud吗公司介绍反问2020.7.20...
2020-07-20 10:43:33 173
原创 【面经】滴滴出行补招-后端开发工程师
前天晚上在微信公众号上看到的补招信息,hr第二天就联系我了,然后约的第二天面试。感觉java也是复习了好久,但是面试就是想不起来,想得起来的又说不出来,面试过程简直惨不忍睹。好在面试官很好,没有给我很大压力,说话很温柔。按照面试流程简单记录一下吧,完全凭记忆,差不多就是这样了。算法1、链表反转2、一个数组内有重复数字,有些数字是偶数个,只有一个数字是奇数个,求奇数个的数字。java基础1、数据结构,自己用过的数据有哪些我说ArrayList,然后问底层实现细节2、计算机网络结构有哪几层,TC
2020-07-16 18:23:52 351
原创 【Java】- TCP、UDP协议实现简易聊天室
简易聊天室数据设计数据设计必要条件:客户端、服务器端必要约束:数据传输协议,使用尾部追加换行结束符原理:服务器端监听消息来源,客户端连接服务器并发送消息到服务器多类型客户端:一客户端发送消息给服务器端,服务器端将该消息转发给其他客户端,实现客户端之间的通信。核心是数据转发协议。...
2020-07-12 11:47:17 659
原创 【Socket网络编程】-UDP辅助TCP实现点到点传输Java
UDP辅助TCP实现点到点传输启动服务器端Server启动客户端Client启动服务器端Server启动客户端Client报错了,检查发现广播地址写成了255,255,255,255,应该是"255.255.255.255"。因为IPv4的地址一般是32为,每8位用.分隔。修改为"255.255.255.255",再运行。。数据无效。。...
2020-07-10 11:13:04 619
原创 【leetcode】-503. Next Greater Element II下一个较大的数II
Next Greater Element II题目单调栈python代码题目Given a circular array (the next element of the last element is the first element of the array), print the Next Greater Number for every element. The Next Greater Number of a number x is the first greater number to i
2020-07-07 21:46:46 236
原创 【leetcode】-496. Next Greater Element I 下一个更大元素I
Next Greater Element I题目暴力法python 代码栈python 代码题目You are given two arrays (without duplicates) nums1 and nums2 where nums1’s elements are subset of nums2. Find all the next greater numbers for nums1’s elements in the corresponding places of nums2.The Nex
2020-07-07 21:22:20 281
原创 【leetcode】-222. Count Complete Tree Nodes计算完全二叉树结点数
Count Complete Tree Nodes题目树的递归python 代码完全二叉树递归python 代码题目Given a complete binary tree, count the number of nodes.Note:Definition of a complete binary tree from Wikipedia:In a complete binary tree every level, except possibly the last, is completely f
2020-07-06 22:21:13 266
原创 【leetcode】-450. Delete Node in a BST删除BST中一个结点
Delete Node in a BST题目递归python 代码题目Given a root node reference of a BST and a key, delete the node with the given key in the BST. Return the root node reference (possibly updated) of the BST.Basically, the deletion can be divided into two stages:Search
2020-07-06 16:56:10 213
原创 【leetcode】-701. Insert into a Binary Search Tree插入数据到二叉搜索树中
Insert into a Binary Search Tree题目递归python 代码题目Given the root node of a binary search tree (BST) and a value to be inserted into the tree, insert the value into the BST. Return the root node of the BST after the insertion. It is guaranteed that the new v
2020-07-06 16:25:53 221
原创 【leetcode】-700. Search in a Binary Search Tree 查找二叉搜索树
Search in a Binary Search Tree题目递归python 代码题目Given the root node of a binary search tree (BST) and a value. You need to find the node in the BST that the node’s value equals the given value. Return the subtree rooted with that node. If such node doesn’t
2020-07-06 16:14:43 636
原创 【leetcode】-98. Validate Binary Search Tree有效的二叉搜索树
Validate Binary Search Tree题目递归python 代码题目Given a binary tree, determine if it is a valid binary search tree (BST).Assume a BST is defined as follows:The left subtree of a node contains only nodes with keys less than the node’s key.The right subtree o
2020-07-06 16:01:08 183
原创 【leetcode】-100. Same Tree判断相同树
Same Tree题目递归python 代码题目Given two binary trees, write a function to check if they are the same or not.Two binary trees are considered the same if they are structurally identical and the nodes have the same value.Example 1:Input: 1 1
2020-07-06 15:43:33 223
原创 【leetcode】-25. Reverse Nodes in k-Group 反转k组数组
Reverse Nodes in k-Group题目递归python 代码题目Given a linked list, reverse the nodes of a linked list k at a time and return its modified list.k is a positive integer and is less than or equal to the length of the linked list. If the number of nodes is not a m
2020-07-06 14:55:57 264
原创 【leetcode】-5. Longest Palindromic Substring求最长回文子串
Longest Palindromic Substring题目动态规划python代码题目Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000.Example 1:Input: “babad”Output: “bab”Note: “aba” is also a valid answer.Example 2:Input:
2020-07-03 09:25:02 259
原创 【leetcode】-83. Remove Duplicates from Sorted List移除排序链表中的重复元素
Remove Duplicates from Sorted List题目快慢指针python代码题目Given a sorted linked list, delete all duplicates such that each element appear only once.Example 1:Input: 1->1->2Output: 1->2Example 2:Input: 1->1->2->3->3Output: 1->2->3
2020-06-24 13:23:28 170
原创 【leetcode】-42. Trapping Rain Water困雨水
Trapping Rain Water题目暴力法备忘录优化双指针题目Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after raining.The above elevation map is represented by array [0,1,0,2,1,0,1,3,2,1
2020-06-24 12:46:34 134
原创 【leetcode】-1011. Capacity To Ship Packages Within D Days
Capacity To Ship Packages Within D Days题目二分法python代码题目A conveyor belt has packages that must be shipped from one port to another within D days.The i-th package on the conveyor belt has a weight of weights[i]. Each day, we load the ship with packages on
2020-06-24 10:37:25 195
原创 【leetcode】-875. Koko Eating Bananas 可可吃香蕉
Koko Eating Bananas题目二分查找python代码题目Koko loves to eat bananas. There are N piles of bananas, the i-th pile has piles[i] bananas. The guards have gone and will come back in H hours.Koko can decide her bananas-per-hour eating speed of K. Each hour, she
2020-06-23 14:43:50 298
原创 【leetcode】-372. Super Pow 超幂运算
Super Pow题目递归python代码题目Your task is to calculate ab mod 1337 where a is a positive integer and b is an extremely large positive integer given in the form of an array.Example 1:Input: a = 2, b = [3]Output: 8Example 2:Input: a = 2, b = [1,0]Output: 1
2020-06-22 23:15:26 430
原创 【leetcode】-204. Count Primes 计算素数
Count Primes题目埃氏筛法python代码题目Count the number of prime numbers less than a non-negative number, n.Example:Input: 10Output: 4Explanation: There are 4 prime numbers less than 10, they are 2, 3, 5, 7.埃氏筛法素数是只能被1和其本身整除的数,最小的素数就是2.埃拉托色尼筛选法(the Sieve of
2020-06-22 22:25:45 229
原创 【leetcode】-773. Sliding Puzzle 滑动迷道
Sliding Puzzle题目bfspython代码题目On a 2x3 board, there are 5 tiles represented by the integers 1 through 5, and an empty square represented by 0.A move consists of choosing 0 and a 4-directionally adjacent number and swapping it.The state of the board is s
2020-06-22 21:59:44 242
原创 【leetcode】-452. Minimum Number of Arrows to Burst Balloons射穿气球的最小数量
Minimum Number of Arrows to Burst Balloons题目贪心法python代码题目There are a number of spherical balloons spread in two-dimensional space. For each balloon, provided input is the start and end coordinates of the horizontal diameter. Since it’s horizontal, y-coor
2020-06-21 14:16:31 203
原创 【leetcode】-435. Non-overlapping Intervals 无重叠区间
Non-overlapping Intervals题目贪心法python代码题目Given a collection of intervals, find the minimum number of intervals you need to remove to make the rest of the intervals non-overlapping.Example 1:Input: [[1,2],[2,3],[3,4],[1,3]]Output: 1Explanation: [1,3] c
2020-06-21 14:00:23 274
原创 【leetcode】-1044. Longest Duplicate Substring 最长重复子串
Longest Duplicate Substring题目暴力法python代码二分法+Rabin-Karppython代码题目Given a string S, consider all duplicated substrings: (contiguous) substrings of S that occur 2 or more times. (The occurrences may overlap.)Return any duplicated substring that has the lo
2020-06-20 23:01:04 419
原创 【leetcode】-111. Minimum Depth of Binary Tree BFS算法
Minimum Depth of Binary Tree题目BFSpython代码题目Given a binary tree, find its minimum depth.The minimum depth is the number of nodes along the shortest path from the root node down to the nearest leaf node.Note: A leaf is a node with no children.Example:G
2020-06-19 14:25:54 191
原创 【leetcode】-51. N-Queens 回溯法解N皇后问题
N-Queens题目回溯法python 代码题目The n-queens puzzle is the problem of placing n queens on an n×n chessboard such that no two queens attack each other.Given an integer n, return all distinct solutions to the n-queens puzzle.Each solution contains a distinct bo
2020-06-19 14:13:26 230
原创 【leetcode】-46. Permutations 回溯法解全排列
Permutations题目回溯法python代码题目Given a collection of distinct integers, return all possible permutations.Example:Input: [1,2,3]Output:[[1,2,3],[1,3,2],[2,1,3],[2,3,1],[3,1,2],[3,2,1]]回溯法回溯法也称为树的深度优先遍历。树的深度优先遍历思想,就是遍历到不满足条件时返回访问其他节点。本题也可看作树的深度优
2020-06-19 13:21:26 219
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人