- 博客(17)
- 问答 (2)
- 收藏
- 关注
原创 leetcode刷题(bytedance面试题)_(2darr,math)_寻找n边形的k等分点
解答:想法:遍历点,当当前遍历的长度大于平均长度时,target就在这条边上。根据之前的last_len以及现有两点的趋势(x平还是y平)来决定 target的增益以及方向(上下左右)。细节:1 为了让点遍历能回到 原点 ,在数组后面添加一个 头2 对应的生成长度数组 存储长度数据(同样要在尾部加 头),得到target点之间的长度average_len(t0到t1的长度)3 ...
2020-01-30 17:58:12 1459
原创 leetcode刷题_(arr,Kadane Algorithm,DP,Greedy)_code55/45(跳子游戏1/2)
code55: Jump GameGiven an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array represents your maximum jump length at that position....
2020-01-29 17:19:32 118
原创 leetcode刷题_(arr,Kadane Algorithm)_code53(最大子数组)
code53: Maximum SubarrayGiven an integer array nums, find the contiguous subarray (containing at least one number) which has the largest sum and return its sum.Example:Input: [-2,1,-3,4,-1,2,1,-5,4...
2020-01-28 19:12:08 182
原创 leetcode刷题_(arr,hashtable)_code49(数组元素归类)
code49: Group AnagramsGiven an array of strings, group anagrams together.Example:Input: [“eat”, “tea”, “tan”, “ate”, “nat”, “bat”],Output:[[“ate”,“eat”,“tea”],[“nat”,“tan”],[“bat”]]解答:1 第一想...
2020-01-28 02:43:21 164
原创 leetcode刷题_(arr,dfs,recursion)_code39/40(数组中寻找固定元素和1/2)
code39:Combination SumGiven a set of candidate numbers (candidates) (without duplicates) and a target number (target), find all unique combinations in candidates where the candidate numbers sums to t...
2020-01-22 18:50:17 110
原创 ***leetcode刷题_(arr,math)_code31(下一个数列)_(arr,str,math,回溯)_code22(产生正确的插入顺序的括号)
code31: Next PermutationImplement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers.If such arrangement is not possible, it must rearrange it ...
2020-01-20 18:53:27 176
原创 leetcode刷题_day14_(str,hashmap)_code3(最长非重子串)
code3: Longest Substring Without Repeating CharactersGiven a string, find the length of the longest substring without repeating characters.Example 1:Input: “abcabcbb”Output: 3Explanation: The ans...
2020-01-14 18:33:15 102
原创 leetcode刷题_day13_(链表)_code82(删除链表中重复的元素)
code82: Remove Duplicates from Sorted List IIGiven a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numbers from the original list.Example 1:Input: 1->2-...
2020-01-11 18:19:39 147
原创 ***leetcode刷题_day12_(树)_code100(相同树)_code94(二叉树中序遍历)
code100:same treeGiven 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...
2020-01-10 19:20:45 376
原创 leetcode刷题_day11_(链表)_code21(合并两个有序链表)_code23(合并K个有序链表)
code21. Merge Two Sorted ListsMerge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists.Example:Input: 1->2->...
2020-01-08 20:53:20 115
原创 leetcode刷题_day10_(链表)_code19(移除链表的倒数第n个节点)
code19: Remove Nth Node From End of ListGiven a linked list, remove the n-th node from the end of list and return its head.Example:Given linked list: 1->2->3->4->5, and n = 2.After rem...
2020-01-07 20:07:10 148
原创 leetcode刷题_day9_(链表)_code2(两数相加)
code2 Add Two Numbers:Add to ListShareYou are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes contain a singl...
2020-01-07 09:08:08 127
原创 python None, is None , ==None区别
None 表示的是一个对象,定义为 Nonetype 的对象。A is None 表示的是 A 的内存地址 与 None 一致,也就是说,如果A是一个对象但是对象属性定义为None的话,依然返回False。因为有对象,即有对应的地址空间。如果 A是一个对象的属性(变量),A的值设定为None,则is None返回True。A==B 表示 对象A和B相等,相当于调用了__eq()__方法。当A...
2020-01-05 15:28:18 6204
原创 *leetcode刷题_day8_(math,int,递归)剑指offer11(数值的整数次方)
剑指offer11 实现power方法,不使用库函数:也就是说求 a**b,不直接使用power方法。解答:最简单的循环相乘法,临界条件:累计乘b次得到结果边界条件:base=0时,输出全为0;exp为0时,输出全为1(对于0**0无意义,可以单独得到结果,解释即可);exp为正时,正常;exp为负时,结果为1/res。代码:省略。tips:可能遇到超时问题,一步步相乘时,过程不...
2020-01-04 18:07:36 97
原创 leetcode刷题_day7_(math,int)code12(整数转罗马数字)
code12整数转罗马数字:罗马数字包含以下七种字符: I, V, X, L,C,D 和 M。字符 数值I 1V 5X 10L 50C 100D 500M 1000例如, 罗马数字 2 写做 I...
2020-01-04 15:57:02 149
原创 leetcode刷题_day6_(math,字符串)code7(字符串转整数)
code7字符串转整数:请你来实现一个 atoi 函数,使其能将字符串转换成整数。首先,该函数会根据需要丢弃无用的开头空格字符,直到寻找到第一个非空格的字符为止。当我们寻找到的第一个非空字符为正或者负号时,则将该符号与之后面尽可能多的连续数字组合起来,作为该整数的正负号;假如第一个非空字符是数字,则直接将其与之后连续的数字字符组合起来,形成整数。该字符串除了有效的整数部分之后也可能会存在多...
2020-01-03 07:11:18 157
原创 操作系统_进程与线程
多道程序设计:允许多个程序同时进入内存运行,目的提高系统效率并发环境:提供一个CPU上同时执行两个或以上的程序,同时处于开始运行但未结束的状态并发程序:在并发环境下执行的程序。(AB不在不在同一时间也算,因为先后不可预测,且也在该环境中。)进程(process):具有独立功能的程序关于某个数据集合上的一次运行活动,是系统进行资源分配和调度的独立单位。又称任务(task)具有独立的地址空...
2020-01-02 12:38:14 109
空空如也
关于python中sys的函数调用问题
2017-08-10
wireshark下载打开后一直在初始化界面未响应状态,求问如何解决。
2017-07-19
TA创建的收藏夹 TA关注的收藏夹
TA关注的人