
面试题
yufengsong09
热爱技术,热爱生活
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
LeetCode---69. Sqrt(x)---Python实现
Implement int sqrt(int x).Compute and return the square root of x.x is guaranteed to be a non-negative integer.Example 1:Input: 4Output: 2Example 2:Input: 8Output: 2Explanation: Th原创 2018-01-22 15:33:58 · 792 阅读 · 0 评论 -
LeetCode 77. Combinations--python实现
Given two integers n and k, return all possible combinations of k numbers out of 1 ... n.For example,If n = 4 and k = 2, a solution is:[ [2,4], [3,4], [2,3], [1,2], [1,3], [1,4],]原创 2018-01-29 11:53:27 · 353 阅读 · 0 评论 -
LeetCode 30. Substring with Concatenation of All Words----Python实现
You are given a string, s, and a list of words, words, that are all of the same length. Find all starting indices of substring(s) in s that is a concatenation of each word in words exactly once and原创 2018-01-29 02:03:46 · 387 阅读 · 0 评论 -
LeetCode 3. Longest Substring Without Repeating Characters---Python实现
Given a string, find the length of the longest substring without repeating characters.Examples:Given "abcabcbb", the answer is "abc", which the length is 3.Given "bbbbb", the answer is "原创 2018-01-29 01:53:53 · 199 阅读 · 0 评论 -
1000个点随机选三个,判断其他点是不是在三角形内部----Python面试题
随机生成1000个点,选取任意3个点组成三角形,问,如何判断其余的997个点在三角形内或外?(请用python实现代码)# -*- coding: utf-8 -*-# author: Yufeng Songimport numpy as npimport random# 定义点class Vertex(object): def __init__(self, x, y): ...原创 2018-02-02 21:47:30 · 1219 阅读 · 1 评论 -
LeetCode 65. Valid Number--Python实现
Validate if a given string is numeric.Some examples:"0" => true" 0.1 " => true"abc" => false"1 a" => false"2e10" => trueNote: It is intended for the problem statement to be ambiguo原创 2018-01-16 15:55:17 · 601 阅读 · 0 评论 -
LeetCode 64. Minimum Path Sum---Python实现
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 at原创 2018-01-16 15:13:29 · 250 阅读 · 0 评论 -
LeetCode 62.Unique Paths---Python实现
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 the原创 2018-01-16 14:48:40 · 844 阅读 · 0 评论 -
LeetCode 72. Edit Distance-----Python实现
Given two words word1 and word2, find the minimum number of steps required to convert word1 to word2. (each operation is counted as 1 step.)You have the following 3 operations permitted on a word:原创 2018-01-24 00:18:53 · 300 阅读 · 0 评论 -
LeetCode 70 Climbing Stairs--Python实现
You are climbing a stair case. It takes n steps to reach to the top.Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top?Note: Given n will be a positive原创 2018-01-22 16:36:58 · 259 阅读 · 0 评论 -
牛客网合唱团
n = 3arr = [7,4,7]K,D = 2,50fm = [([0] * n) for i in range(K)] # k*dfn = [([0] * n) for i in range(K)] # k*dres = 0# for i in range(n):# fm[0][i] = arr[i]# fn[0][i] = arr[i]## fo...原创 2018-11-07 09:31:23 · 327 阅读 · 0 评论