自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

Jasmine_dream

Machine learning , NLP

  • 博客(206)
  • 资源 (1)
  • 收藏
  • 关注

原创 拼多多2019.09.01秋招笔试 算法工程师 python 解法

def pdd_1(): # 根据取模运算,将奇数和偶数分开,分别排序,之后拼接输出 # nums, N = input().split(';') aa = '555503,772867,756893,339138,399447,40662,859037,628085,855723,974471,599631,636153,581541,174761,948135,41...

2019-09-02 12:12:04 437

原创 leetcode 004 Median of Two Sorted Arrays 寻找两个有序数组的中位数 python O(logn)

所有Leetcode题目不定期汇总在 Github, 欢迎大家批评指正,讨论交流。'''# There are two sorted arrays nums1 and nums2 of size m and n respectively.# Find the median of the two sorted arrays. The overall run time complexity ...

2019-08-17 15:34:50 241

原创 leetcode 033 081 Search in Rotated Sorted Array 搜索旋转排序数组 python 二分查找

所有Leetcode题目不定期汇总在 Github, 欢迎大家批评指正,讨论交流。'''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])....

2019-08-05 21:48:02 250

原创 剑指offer第二版 面试题62 孩子们的游戏(圆圈中最后剩下的数) python 动规

所有题目单独整理的版本存储在这里, 点击题目名字可以跳转到牛客网的成功提交记录,点击python可以看到存储库中的对应求解代码。'''每年六一儿童节,牛客都会准备一些小礼物去看望孤儿院的小朋友,今年亦是如此。HF作为牛客的资深元老,自然也准备了一些小游戏。其中,有个游戏是这样的:首先,让小朋友们围成一个大圈。然后,他随机指定一个数m,让编号为0的小朋友开始报数。每次喊到m-1的那个小朋友要...

2019-06-17 19:37:19 628

原创 剑指offer第二版 面试题61 扑克牌顺子 python

所有题目单独整理的版本存储在这里, 点击题目名字可以跳转到牛客网的成功提交记录,点击python可以看到存储库中的对应求解代码。'''LL今天心情特别好,因为他去买了一副扑克牌,发现里面居然有2个大王,2个小王(一副牌原本是54张^_^)...他随机从中抽出了5张牌,想测测自己的手气,看看能不能抽到顺子,如果抽到的话,他决定去买体育彩票,嘿嘿!!“红心A,黑桃3,小王,大王,方片5”,“...

2019-06-17 19:35:57 266

原创 剑指offer第二版 面试题60 n个骰子的点数 python 动规

所有题目单独整理的版本存储在这里, 点击题目名字可以跳转到牛客网的成功提交记录,点击python可以看到存储库中的对应求解代码。把n个骰子仍在地上,所有骰子朝上一面的点数之和为s。输入n,打印出s的所有可能的值出现的概率。def offer60(n): # 第n个骰子得到k的次数由n-1个骰子 k-1 ~ k-6 的个数和所决定,动规递推式 # f(n,k) = f(n-1...

2019-06-17 14:55:20 773

原创 leetcode239 Sliding Window Maximum 滑动窗口最大值 python 双向队列

所有Leetcode题目不定期汇总在 Github, 欢迎大家批评指正,讨论交流。'''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 numbe...

2019-06-16 19:33:34 344

原创 leetcode 069 Sqrt(x) x 的平方根 python 数值二分

'''Implement int sqrt(int x).Compute and return the square root of x, where x is guaranteed to be a non-negative integer.Since the return type is an integer, the decimal digits are truncated and...

2019-06-13 17:25:00 217

原创 leetcode 426 将二叉搜索树转化为排序的双向链表 python 中序递归

所有Leetcode题目不定期汇总在 Github, 欢迎大家批评指正,讨论交流。其实就是在中序遍历的递归过程中加入一个辅助指针,另外用一个额外指针记住中序遍历开头的位置,转化过程的参考图片来自博客# -*- coding:utf-8 -*-# class TreeNode:# def __init__(self, x):# self.val = x# ...

2019-06-04 16:13:26 1118

原创 leetcode 172. Factorial Trailing Zeroes 阶乘后的零 python 数学

所有Leetcode题目不定期汇总在 Github, 欢迎大家批评指正,讨论交流。'''Given an integer n, return the number of trailing zeroes in n!.Example 1:Input: 3Output: 0Explanation: 3! = 6, no trailing zero.Example 2:Inpu...

2019-05-30 09:13:30 117

原创 leetcode 打家劫舍系列 198、213、337 python 动规

三道题都是动规解题,总体上就是在迭代的过程中保留更新两个数。分别是到目前为止,选择打劫相邻房子和不打劫相邻房子的最大值,迭代推出下一位置的结果。'''You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the...

2019-05-29 19:22:27 214

原创 剑指offer第二版 python 牛客网刷题全记录

每个题目单独整理的版本存储在这里, 点击题目名字可以跳转到牛客网的成功提交记录,点击python可以看到存储库中的对应求解代码。# -*- coding: utf-8 -*-from binarytree import tree# Definition for singly-linked list.class ListNode(object): def __init__(s...

2019-05-27 20:35:38 3072 1

原创 leetcode 021 合并两个有序链表 Merge Two Sorted Lists python 循环+ 递归 O(n+m) , O(1)

所有Leetcode题目不定期汇总在 Github, 欢迎大家批评指正,讨论交流。'''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:...

2019-05-26 11:04:31 121

原创 leetcode 023 Merge k Sorted Lists 合并K个排序链表 最高效解法 O(nlogk) O(1)

所有Leetcode题目不定期汇总在 Github, 欢迎大家批评指正,讨论交流。'''Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity.Example:Input:[ 1->4->5, 1->3->4,...

2019-05-26 11:01:19 194

原创 【阅读笔记】项亮前辈的《推荐系统实战》

推荐系统是个有意思的方向。项亮前辈的《推荐系统实战》来当作入门的第一本书还是很合适的,这段时间在断断续续的抽空阅读了一遍。本书写的浅显易懂,很好的勾勒出了推荐引擎十年前的主流算法,以及工业推荐系统是如何打磨的。从这个角度讲,项亮前辈很好地完成了”让学生了解如何将自己了解的算法实现到一个工业系统中去“这一写作目标。看书的过程中简单记录了一些内容,夹杂着自己突然产生的一些想法。用以过段时间后的来重新...

2019-05-24 15:06:03 1151

原创 leetcode 225 Implement Stack using Queues 用队列实现栈 python 双队列

所有Leetcode题目不定期汇总在 Github, 欢迎大家批评指正,讨论交流。'''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...

2019-04-20 10:23:38 189

原创 leetcode 232 Implement Queue using Stacks 用栈实现队列 python

所有Leetcode题目不定期汇总在 Github, 欢迎大家批评指正,讨论交流。'''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 fron...

2019-04-19 22:42:05 136

原创 leetcode 120 Triangle 三角形最小路径和 python 动规

所有Leetcode题目不定期汇总在 Github, 欢迎大家批评指正,讨论交流。'''Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below.For example, given the fol...

2019-04-10 10:11:21 271

原创 leetcode 096 Unique Binary Search Trees 不同的二叉搜索树 python 动规 , 最简代码

所有Leetcode题目不定期汇总在 Github, 欢迎大家批评指正,讨论交流。'''Given n, how many structurally unique BST's (binary search trees) that store values 1 ... n?Example:Input: 3Output: 5Explanation:Given n = 3, the...

2019-04-09 16:33:49 138

原创 leetcode 859 亲密字符串 Buddy Strings python 多种解法,最简代码

所有Leetcode题目不定期汇总在 Github, 欢迎大家批评指正,讨论交流。'''Given two strings A and B of lowercase letters, return true if and only if we can swap two letters in A so that the result equals B.Example 1:Inpu...

2019-04-09 14:41:57 289

原创 leetcode 064 Minimum Path Sum 最小路径和 python 动规

所有Leetcode题目不定期汇总在 Github, 欢迎大家批评指正,讨论交流。'''Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right which minimizes the sum of all numbers along its path.N...

2019-04-09 14:25:52 114

原创 leetcode 072 Edit Distance 编辑距离 python 动规

所有Leetcode题目不定期汇总在 Github, 欢迎大家批评指正,讨论交流。‘’’Given two words word1 and word2, find the minimum number of operations required to convert word1 to word2.You have the following 3 operations permitted...

2019-04-09 14:23:55 147

原创 leetcode 877 Stone Game 石子游戏 python 动规

所有Leetcode题目不定期汇总在 Github, 欢迎大家批评指正,讨论交流。‘’’Alex and Lee play a game with piles of stones. There are an even number of piles arranged in a row, and each pile has a positive integer number of ston...

2019-04-09 14:22:26 242

原创 leetcode 112 Path Sum 路径总和 python 最简代码

所有Leetcode题目不定期汇总在 Github, 欢迎大家批评指正,讨论交流。'''Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum.N...

2019-03-28 09:06:07 231

原创 leetcode 003 Longest Substring Without Repeating Characters 无重复字符的最长子串 python

所有Leetcode题目不定期汇总在 Github, 欢迎大家批评指正,讨论交流。'''Given a string, find the length of the longest substring without repeating characters.Example 1:Input: "abcabcbb"Output: 3Explanation: The answer...

2019-03-21 16:42:59 89

原创 leetcode 138 复制带随机指针的链表 Copy List with Random Pointer python O(n) O(1)

所有Leetcode题目不定期汇总在 Github, 欢迎大家批评指正,讨论交流。'''A linked list is given such that each node contains an additional random pointer which could point to any node in the list or null.Return a deep copy ...

2019-03-20 21:01:37 312

原创 leetcode 430 Flatten a Multilevel Doubly Linked List 扁平化多级双向链表 python

所有Leetcode题目不定期汇总在 Github, 欢迎大家批评指正,讨论交流。'''You are given a doubly linked list which in addition to the next and previous pointers, it could have a child pointer, which may or may not point to a ...

2019-03-20 16:15:08 260

原创 leetcode 061 旋转链表 Rotate List python 前后指针定位

所有Leetcode题目不定期汇总在 Github, 欢迎大家批评指正,讨论交流。'''Given a linked list, rotate the list to the right by k places, where k is non-negative.Example 1:Input: 1->2->3->4->5->NULL, k = 2O...

2019-03-20 15:35:21 119

原创 leetcode 328 奇偶链表 Odd Even Linked List python 前后指针

所有Leetcode题目不定期汇总在 Github, 欢迎大家批评指正,讨论交流。'''Given a singly linked list, group all odd nodes together followed by the even nodes. Please note here we are talking about the node number and not the ...

2019-03-20 10:59:54 202

原创 leetcode 203 Remove Linked List Elements 移除链表元素 python

所有Leetcode题目不定期汇总在 Github, 欢迎大家批评指正,讨论交流。'''Remove all elements from a linked list of integers that have value val.Example:Input: 1->2->6->3->4->5->6, val = 6Output: 1-&gt...

2019-03-20 10:30:00 220

原创 leetode 142 Linked List Cycle II 环形链表 II python

所有Leetcode题目不定期汇总在 Github, 欢迎大家批评指正,讨论交流。'''Given a linked list, return the node where the cycle begins. If there is no cycle, return null.To represent a cycle in the given linked list, we use ...

2019-03-19 17:00:52 183

原创 leetcode 707 设计链表 Design Linked List python(list 构造)

所有Leetcode题目不定期汇总在 Github, 欢迎大家批评指正,讨论交流。'''Design your implementation of the linked list. You can choose to use the singly linked list or the doubly linked list. A node in a singly linked list ...

2019-03-19 15:33:37 456

原创 leetcode 043 字符串相乘(大数相乘问题) Multiply Strings python

所有Leetcode题目不定期汇总在 Github, 欢迎大家批评指正,讨论交流。'''Given two non-negative integers num1 and num2 represented as strings, return the product of num1 and num2, also represented as a string.Example 1:...

2019-03-17 22:56:33 198

原创 leetcode 002 两数相加 Add Two Numbers python

所有Leetcode题目不定期汇总在 Github, 欢迎大家批评指正,讨论交流。'''You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes contai...

2019-03-17 10:12:32 122

原创 leetcode 059 Spiral Matrix II 螺旋矩阵 II python 最高效解

所有Leetcode题目不定期汇总在 Github, 欢迎大家批评指正,讨论交流。'''Given a positive integer n, generate a square matrix filled with elements from 1 to n2 in spiral order.Example:Input: 3Output:[ [ 1, 2, 3 ], [ 8...

2019-03-16 19:41:12 133

原创 leetcode 160 Intersection of Two Linked Lists 相交链表 python 两次循环对齐

所有Leetcode题目不定期汇总在 Github, 欢迎大家批评指正,讨论交流。'''Write a program to find the node at which the intersection of two singly linked lists begins.For example, the following two linked lists:begin to ...

2019-03-16 16:44:43 125

原创 leetocode 053 Maximum Subarray 最大子序和 python 动态规划

所有Leetcode题目不定期汇总在 Github, 欢迎大家批评指正,讨论交流。'''Given an integer array nums, find the contiguous subarray (containing at least one number) which has the largest sum and return its sum.Example:Inpu...

2019-03-16 16:15:34 123

原创 leetcode 235 Lowest Common Ancestor of a Binary Search Tree 二叉搜索树的最近公共祖先 python 最简解法(迭代、递归)

所有Leetcode题目不定期汇总在 Github, 欢迎大家批评指正,讨论交流。'''Given a binary search tree (BST), find the lowest common ancestor (LCA) of two given nodes in the BST.According to the definition of LCA on Wikipedia...

2019-03-16 10:45:23 107

原创 leetcode 078 Subsets 子集 python最简代码(递归、迭代、位运算)

所有Leetcode题目不定期汇总在 Github, 欢迎大家批评指正,讨论交流。'''Given a set of distinct integers, nums, return all possible subsets (the power set).Note: The solution set must not contain duplicate subsets.Examp...

2019-03-16 09:49:22 507

原创 leetcode 101 Symmetric Tree 对称二叉树 python (迭代+递归)

所有Leetcode题目不定期汇总在 Github, 欢迎大家批评指正,讨论交流。'''Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).For example, this binary tree [1,2,2,3,4,4,3] is symmet...

2019-03-15 17:04:44 321

基于同一局域网下的多台电脑屏幕分享

当多台电脑连在同一个局域网中时,运用这份代码可以实现屏幕分享功能。 原理是截取屏幕,发送到对方电脑上,当速度足够快时,表现得会很流畅。 可以用于老师教学时的屏幕分享。

2015-12-14

空空如也

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

TA关注的人

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