自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

肖冬禹要拿offer的博客

后端,机器学习,人工智能方向,欢迎大佬指导,内推~

  • 博客(42)
  • 收藏
  • 关注

原创 Leetcode 9. Palindrome Number

class Solution { public boolean isPalindrome(int x) { if (x < 0) { return false; } else if (x == 0) { return true; } else { String num = String.valueOf(x); int start = 0; ...

2021-08-22 14:49:05 141

原创 Leetcode Reverse Integer

class Solution { public int reverse(int x) { StringBuilder res = new StringBuilder(); boolean flag = false; if (x < 0) { flag = true; x *= -1; } if (x == 0) { return x; ...

2021-08-22 14:41:18 110

原创 Leetcode Two Sum

public class TwoSum { public int[] twoSum(int[] nums, int target) { Map<Integer, Integer> mem = new HashMap<>(); for (int i = 0; i < nums.length; i++) { if (mem.containsKey(target - nums[i])) { .

2021-08-22 13:06:58 114

原创 拼多多面试跪经

学长帮忙内推了一波,然后做了笔试,通过,前面刚经过了第一轮面试。感觉是跪了。这里记录下,警示后人。。。。一.笔试第一问.给定一个数组,任选两个元素求和,[a1,a2]和[a3,a4],使得(a1+a2)-(a3+a4)差最小。import itertoolsimport sysdef solution(N,nums): candidates=itertools.com...

2019-04-19 09:04:39 5804 2

原创 LeetCode重点题系列之【75. Sort Colors】

Given an array withnobjects colored red, white or blue, sort themin-placeso that objects of the same color are adjacent, with the colors in the order red, white and blue.Here, we will use the in...

2019-04-13 08:14:52 216

原创 LeetCode重点题系列之【53. Maximum Subarray】

Given an integer arraynums, 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],Output: 6Explanati...

2019-04-10 12:40:28 212

原创 LeetCode重点题系列之【33. Search in Rotated Sorted Array】

Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand.(i.e.,[0,1,2,4,5,6,7]might become[4,5,6,7,0,1,2]).You are given a target value to search. If found ...

2019-04-09 07:17:26 179

原创 LeetCode重点题系列之【32. Longest Valid Parentheses】

Given a string containing just the characters'('and')', find the length of the longest valid (well-formed) parentheses substring.Example 1:Input: "(()"Output: 2Explanation: The longest valid...

2019-04-09 06:27:31 193

原创 LeetCode重点题系列之【583. Delete Operation for Two Strings】

Given two wordsword1andword2, find the minimum number of steps required to makeword1andword2the same, where in each step you can delete one character in either string.Example 1:Input: "sea...

2019-04-08 13:25:18 327

原创 LeetCode重点题系列之【28. Implement strStr()】

ImplementstrStr().Return the index of the first occurrence of needle in haystack, or-1if needle is not part of haystack.Example 1:Input: haystack = "hello", needle = "ll"Output: 2Example...

2019-04-08 11:48:26 164

原创 LeetCode重点题系列之【12. Integer to Roman】

Roman numerals are represented by seven different symbols:I,V,X,L,C,DandM.Symbol ValueI 1V 5X 10L 50C 100D ...

2019-04-07 08:34:37 178

原创 LeetCode重点题系列之【10. Regular Expression Matching】

Given an input string (s) and a pattern (p), implement regular expression matching with support for'.'and'*'.'.' Matches any single character.'*' Matches zero or more of the preceding element....

2019-04-07 00:31:33 199

原创 LeetCode重点题系列之【26. Remove Duplicates from Sorted Array】

Given a sorted arraynums, remove the duplicatesin-placesuch that each element appear onlyonceand return the new length.Do not allocate extra space for another array, you must do this bymodifyin...

2019-04-06 12:20:31 182

原创 LeetCode重点题系列之【20. Valid Parentheses】

Mergeksorted linked lists and return it as one sorted list. Analyze and describe its complexity.Example:Input:[ 1->4->5, 1->3->4, 2->6]Output: 1->1->2->3->4-...

2019-04-06 08:12:20 180

原创 LeetCode重点题系列之【21. Merge Two Sorted Lists】

Merge 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->4, 1->3->4Output: 1-...

2019-04-06 07:47:32 198

原创 LeetCode重点题系列之【22.Generate Parentheses】

Givennpairs of parentheses, write a function to generate all combinations of well-formed parentheses.For example, givenn= 3, a solution set is:[ "((()))", "(()())", "(())()", "()(())"...

2019-04-06 07:06:23 182

原创 LeetCode重点题系列之【20. Valid Parentheses】

Given a string containing just the characters'(',')','{','}','['and']', determine if the input string is valid.An input string is valid if:Open brackets must be closed by the same type of b...

2019-04-06 00:31:06 249

原创 LeetCode重点题系列之【17. Letter Combinations of a Phone Number】

Given a string containing digits from2-9inclusive, return all possible letter combinations that the number could represent.A mapping of digit to letters (just like on the telephone buttons) is giv...

2019-04-05 13:41:51 250

原创 LeetCode重点题系列之【15. 3Sum】

Given an arraynumsofnintegers, are there elementsa,b,cinnumssuch thata+b+c= 0? Find all unique triplets in the array which gives the sum of zero.Note:The solution set must not conta...

2019-04-05 12:52:14 181

原创 LeetCode重点题系列之【42. Trapping Rain Water】

Givennnon-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...

2019-04-05 08:05:52 282

原创 LeetCode重点题系列之【11. Container With Most Water】

Givennnon-negative integersa1,a2, ...,an, where each represents a point at coordinate (i,ai).nvertical lines are drawn such that the two endpoints of lineiis at (i,ai) and (i, 0). Find two...

2019-04-05 07:27:21 283

原创 LeetCode重点题系列之【4. Median of Two Sorted Arrays】

There are two sorted arraysnums1andnums2of size m and n respectively.Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)).You may assumenums1andn...

2019-04-05 06:43:38 159

原创 LeetCode重点题系列之【5. Longest Palindromic Substring】

Given a strings, find the longest palindromic substring ins. You may assume that the maximum length ofsis 1000.Example 1:Input: "babad"Output: "bab"Note: "aba" is also a valid answer.Exa...

2019-04-04 14:18:08 164

原创 LeetCode重点题系列之【3. Longest Substring Without Repeating Characters】

Given a string, find the length of thelongest substringwithout repeating characters.Example 1:Input: "abcabcbb"Output: 3 Explanation: The answer is "abc", with the length of 3. Example 2:...

2019-04-04 09:06:49 104

原创 LeetCode重点题系列之【一. Two Sum】

LeetCode刷了也有350题了,觉得再刷新题没有必要了,开一个新的系列,LeetCode重点题精刷。Given an array of integers, returnindicesof the two numbers such that they add up to a specific target.You may assume that each input would ha...

2019-04-03 11:51:36 174

原创 659. Split Array into Consecutive Subsequences

You are given an integer array sorted in ascending order (may contain duplicates), you need to split them into several subsequences, where each subsequences consist of at least 3 consecutive integers....

2019-04-02 08:15:35 221

原创 416. Partition Equal Subset Sum

Given anon-emptyarray containingonly positive integers, find if the array can be partitioned into two subsets such that the sum of elements in both subsets is equal.Note:Each of the array eleme...

2019-03-27 13:24:03 133

原创 leetcode 621. Task Scheduler

Given a char array representing tasks CPU need to do. It contains capital letters A to Z where different letters represent different tasks. Tasks could be done without original order. Each task could ...

2019-03-27 06:21:15 143

原创 LeetCode 241. Different Ways to Add Parentheses

Given a string of numbers and operators, return all possible results from computing all the different possible ways to group numbers and operators. The valid operators are+,-and*.Example 1:Inp...

2019-03-27 01:44:35 156

原创 39. Combination Sum

https://leetcode.com/problems/combination-sum/Given asetof candidate numbers (candidates)(without duplicates)and a target number (target), find all unique combinations incandidateswhere the ca...

2019-03-15 05:33:16 157

原创 46. Permutations

经典题了https://leetcode.com/problems/permutations/Given a collection ofdistinctintegers, return all possible permutations.Example:Input: [1,2,3]Output:[ [1,2,3], [1,3,2], [2,1,3], [2...

2019-03-15 02:23:09 156

原创 17. Letter Combinations of a Phone Number

https://leetcode.com/problems/letter-combinations-of-a-phone-number/Given a string containing digits from2-9inclusive, return all possible letter combinations that the number could represent.A m...

2019-03-15 01:39:06 161

原创 22. Generate Parentheses

https://leetcode.com/problems/generate-parentheses/Givennpairs of parentheses, write a function to generate all combinations of well-formed parentheses.For example, givenn= 3, a solution set i...

2019-03-15 01:12:24 160

原创 从0开始搭建完整的电影推荐系统网站五(Python+Django)

今天讲冷启动冷产品,比如新出的电影。冷用户,新用户。灰羊,就是那种有奇怪癖好的人。一。算法1.考虑使用已知关联规则,用户进行第一个操作后,就开始关联推荐2.利用Segments就是按照年龄,地区这种明显的特征,或者直接根据特征聚类3.利用分类,或者抽象出来的概念分类二。我们的电影推荐网站使用的是关联规则...

2019-03-12 07:29:36 3830 3

原创 从0开始搭建完整的电影推荐系统网站五(Python+Django)

本网站有两个组成部分:Builder: 预计算 推荐怎么说呢,我感觉就是把推荐,网站,分析,收集器,每个都是个微服务,用用API交互,反正就这个感觉。一。给网站添加图表二 。Seeded recommendations这名字从没听过,但是书中讲的目测就是频繁项,频繁出现在一起的商品,作为彼此的推荐。具体原理耳熟能详就不说了,自行百度吧。重点要知道自信度 ,支...

2019-03-11 14:05:31 5809

原创 从0开始搭建完整的电影推荐系统网站四(Python+Django)

这章内容看起来像数据清洗,应该不难,就是整理数据方便后面算法使用。OK,开始!!!好兴奋!!!一. 用户物品矩阵没什么好说的,非常Intuitive。左边那一列是人名,上面那一行是电影名,表格里是评分,空白代表没看过。这里的评分可以是用户自己打的分,也可以是我们通过他在网上的行为,历史浏览记录之类的隐式推断出来的。二。如何计算评分这里我们采取隐式评分,显示评分太弱智了。...

2019-03-10 06:55:39 3993

原创 从0开始搭建完整的电影推荐系统网站三(Python+Django)

这章讲讲监控上一章主要讲的怎么收集用户数据。这章讲监控(程序里是analytics分析网站性能效果的,怎么总觉得这是运维干的,anyway肖哥全栈666)分析网站性能挺重要的,你可以靠这个和老板吹牛。所谓数据驱动决策,可视化网站性能,有很多实际意义~一。Web分析分成两个部分:off-site on-siteoff-site关心三个方面:Opportunity:通过流量...

2019-03-09 15:48:23 4055

原创 从0开始搭建完整的电影推荐系统网站二(Python+Django)

这章我们来讲如何收集用户信息一. 首先,我们思考下用户在网站上一般有哪些些行为:随意浏览 卧槽,这个东西有点意思 点开来看看,加上收藏 买之前点开的东西 消费这个东西(比如电影) 评分 用户再次购买或者直接厌恶的不鸟它!这里其实每步都可以收集很多信息。购买前的点有:购买用户浏览某个信息的时间、扩展阅读、看评论、转发、收藏、关键词搜索、购买行为等等。 购买后消费的点:比如...

2019-03-09 11:40:55 5000 1

原创 从0开始搭建完整的电影推荐系统网站一(Python+Django)

读研这么久搞了不少推荐算法相关的东西,但重心都放在算法研究和实现上了。所以一直想做一个完整的带有人机交互的推荐网站,可惜的是之前能找到的资料都是JAVA WEB,对环境要求高,而且用的技术栈太多,相当繁琐,导致一直没有成功。最近终于在网上看到一本神书《Practical Recommender Systems; Kim Falk;January 2019》。不仅有算法,还有前后端实现。所以,中央决...

2019-03-09 10:43:12 24268 23

原创 Python 迭代器和生成器的区别

常见基础问题,老忘,写一波提醒自己。1. 首先,要了解什么是Iterables。我们常常这么写一个遍历打印程序,一个一个来读取元素的值。&gt;&gt;&gt; mylist = [1, 2, 3]&gt;&gt;&gt; for i in mylist:... print(i)123基本上for ....... in ........这种结构都适用于Iterable...

2019-03-09 02:56:08 337

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除