自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(14)
  • 收藏
  • 关注

原创 2017 美团编程题

[编程题] 大富翁游戏大富翁游戏,玩家根据骰子的点数决定走的步数,即骰子点数为1时可以走一步,点数为2时可以走两步,点数为n时可以走n步。求玩家走到第n步(n<=骰子最大点数且是方法的唯一入参)时,总共有多少种投骰子的方法。 输入描述:输入包括一个整数n,(1 ≤ n ≤ 6)输出描述:输出一个整数,表示投骰子的方法输入例子1:6输出例子1:32分...

2018-08-27 18:47:32 258

原创 树的复习

"""This script concerns tree structure and its kinds of traversal: inorder, preorder, postorder and level order"""class Node():    def __init__(self, x=-1):        self.val = x        self.left ...

2018-08-23 16:44:52 146

原创 排序复习

# bubble sort# 冒泡排序(交换排序)"""- 基本思想是 通过与相邻元素的比较和交换,把较小的元素交换到最前面。- 时间复杂度 O(n^2), 空间复杂度 O(1)"""def bubble_sort(seq):    n = len(seq)    for i in range(n-1, -1, -1):        for j in range(i):  ...

2018-08-23 16:44:09 159

原创 sublime正则命令

sublime 大小写转换- 查找 ([\w\d]+) 或者(/?\w+)- 替换小写 \L$1, 改为大写\U$1去重查找(^.*\n)(?=\1)替换空添加前后缀.* 要添加字符$0 

2018-08-23 16:03:24 993

原创 leetcode 152. Maximum Product Subarray

Given an integer array nums, find the contiguous subarray within an array (containing at least one number) which has the largest product.Example 1:Input: [2,3,-2,4]Output: 6Explanation: [2,3]...

2018-08-20 21:51:01 109

原创 leetcode 139. Word Break

Given a non-empty string s and a dictionary wordDict containing a list of non-empty words, determine if s can be segmented into a space-separated sequence of one or more dictionary words.Note:...

2018-08-20 21:32:21 245

原创 leetcode 120. Triangle

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 following triangle [ [2], [3...

2018-08-17 21:42:15 207

原创 leetcode 91. Decode Ways

A message containing letters from A-Z is being encoded to numbers using the following mapping: ‘A’ -> 1 ‘B’ -> 2 … ‘Z’ -> 26 Given a non-empty string containing only digits,...

2018-08-16 22:00:57 133

原创 leetcode 64. Minimum Path Sum

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. Note: You can only move either down or right...

2018-08-16 19:58:05 106

原创 leetcode 63. Unique Paths II

引用块内容

2018-08-16 00:00:13 98

原创 leetcode 62. Unique Paths

A robot is located at the top-left corner of a m x n grid (marked ‘Start’ in the diagram below). The robot can only move either down or right at any point in time. The robot is trying to reach t...

2018-08-15 23:14:12 189

原创 表达式求值(2019网易编程题)

今天上课,老师教了小易怎么计算加法和乘法,乘法的优先级大于加法,但是如果一个运算加了括号,那么它的优先级是最高的。例如: 1 2 3 4 1+2*3=7 1*(2+3)=5 1*2*3=6 (1+2)*3=9 现在小易希望你帮他计算给定3个数a,b,c,在它们中间添加”+”, “*”, “(“, “)”符号,能够获得的最大值。输入描述:一行三个数a,b,c (1 &l...

2018-08-15 21:11:02 809

原创 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: ...

2018-08-15 20:52:09 138

原创 网易2019秋季校园招聘编程题真题部分

1。俄罗斯方块 小易有一个古老的游戏机,上面有着经典的游戏俄罗斯方块。因为它比较古老,所以规则和一般的俄罗斯方块不同。 荧幕上一共有 n 列,每次都会有一个 1 x 1 的方块随机落下,在同一列中,后落下的方块会叠在先前的方块之上,当一整行方块都被占满时,这一行会被消去,并得到1分。 有一天,小易又开了一局游戏,当玩到第 m 个方块落下时他觉得太无聊就关掉了,小易希望你告诉他这...

2018-08-15 00:10:45 1978

空空如也

空空如也

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

TA关注的人

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