前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >狗家算法面试高频题汇总

狗家算法面试高频题汇总

原创
作者头像
王脸小
修改2019-11-15 10:09:20
9220
修改2019-11-15 10:09:20
举报
文章被收录于专栏:王漂亮王漂亮

Google 面试题 | 种花

leet

代码语言:javascript
复制
class Solution:
    def canPlaceFlowers(self, flowerbed: List[int], n: int) -> bool:
        if not flowerbed: return not n
        
        cnt = 0
        for i in range(len(flowerbed)): 
            if flowerbed[i] == 0 and (i == 0 or flowerbed[i-1] == 0) 
                and (i == len(flowerbed)-1  or flowerbed[i+1] == 0):
                
                flowerbed[i] = 1
                cnt += 1
                
        return cnt >= n

Google 面试题 | 分饼干

Assign Cookies

代码语言:javascript
复制
class Solution:
    def findContentChildren(self, g: List[int], s: List[int]) -> int:
        g.sort()
        s.sort()
        
        i, j, cnt = 0, 0, 0
        while i < len(g) and j < len(s):
            if g[i] <= s[j]:
                i+=1
                j+=1
                cnt+=1
            else:
                j+=1
                    
        return cnt        

Google 面试题 | 重复子字符串串模式

Repeated Substring Pattern

代码语言:javascript
复制
class Solution:
    def repeatedSubstringPattern(self, s: str) -> bool:
        for i in range(len(s)//2):
            if len(s) % (i+1) == 0 and s[:i+1] * (len(s)//(i+1)) == s:
                return True
        return False

Google 面试题 | 最优账户结余

Optimal Account Balancing - H

Google 面试题 | 132 模式

jiuzhang

Google 面试题 | 检查子序列

Google 面试题 | 目标和

Google 面试题 | 建邮局

Google 面试题 | 0与1的问题

Google 面试题 | 验证UTF-8

Google 面试题 | Data Stream Median - Python版

Google 面试题 | 二进制手表

Google 面试题 | 硬币排成一条线3

Google 面试题 | 除法求值

Google 面试题 | 不同的子序列 列 解法1

Google 面试题 | 贪吃蛇

Google 面试题 | 数字计数

Google 面试题 | Palindrome Partitioning II

Google 面试题 | 最大可分子集

Google 面试题 | 轴对称Google ⾯面试题 | 俄罗斯套娃信封

Google 面试题 | Search a 2D Matrix II

Google 面试题 | 寻找中位数

Google 面试题 | 路路线重现

Google 面试题 | 找出dictionary里含某车牌号码的所有英文字母的最短单词

Google 面试题 | 数组补丁

Google 面试题 | 不不构造树的情况下验证先序遍历

Google 面试题 | 摆动排序 II

Google 面试题 | 矩阵中的最长上升路路径

Google 面试题 | 岛屿计数2

Google 面试题 | Count of Smaller Numbers After Self(数组计数)

Google 面试题 | 翻转游戏(Flip Game II)

Google 面试题 | 吹气球

Google 面试题 | 去除文件中的重复行

Google 面试题 | 最多有k个不同字符的最长子字符串

Google 面试题 | 哈明顿距离公告通知最多有k个不同字符的最长子字符串

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档