有效的字母异位词 题目地址:https://leetcode-cn.com/problems/valid-anagram/ 给定两个字符串 s 和 t ,编写一个函数来判断 t 是否是 s 的字母异位词。 示例 1: 输入: s = "anagram", t = "nagaram" 输出: true ...
分类:
编程语言 时间:
2020-12-15 12:32:59
阅读次数:
4
int cmp(const void* a, const void* b){ return *(int*)a - *(int*)b; } void recursion(int* nums, int numsSize, int* returnSize, int* returnColumnSizes, ...
分类:
其他好文 时间:
2020-12-15 12:32:10
阅读次数:
3
589. N叉树的前序遍历 Difficulty: 简单 给定一个 N 叉树,返回其节点值的_前序遍历_。 例如,给定一个 3叉树 : 返回其前序遍历: [1,3,5,6,2,4]。 **说明: **递归法很简单,你可以使用迭代法完成此题吗? Solution Language: **** """ ...
分类:
其他好文 时间:
2020-12-14 13:21:17
阅读次数:
3
###题目 389. Find the Difference ###解题方法 先统计两个字符串中每个字母的出现次数,记为dic_s和dic_t,先遍历dic_s,找一个在dic_t中没出现的字母,或者在dic_t中出现了但是频数和dic_s中不一样的字母,找到了就break不做了,要是没找到就再去d ...
分类:
其他好文 时间:
2020-12-14 13:02:21
阅读次数:
3
Description: Given a (singly) linked list with head node root, write a function to split the linked list into k consecutive linked list "parts". The l ...
分类:
其他好文 时间:
2020-12-14 13:00:34
阅读次数:
3
记录 ###I 通过:1, 错误:206(递归返回条件和边界条件), 1.两数之和-简单 class Solution: def twoSum(self, nums: List[int], target: int) -> List[int]: lookup = {} for i in range(l ...
分类:
其他好文 时间:
2020-12-14 12:59:21
阅读次数:
3
515. 在每个树行中找最大值 Difficulty: 中等 您需要在二叉树的每一行中找到最大的值。 示例: 输入: 1 / \ 3 2 / \ \ 5 3 9 输出: [1, 3, 9] Solution Language: **** BFS+queue实现层序遍历,十分easy,一次AC。 # ...
分类:
其他好文 时间:
2020-12-11 12:12:45
阅读次数:
4
前言众所周知,对于面试而言,《剑指offer》是一本“好书”。如果你和我一样是个算法菜鸡,那么最推荐的是先把剑指offer的题目搞明白,其次再去刷LeetCode等习题,这样对于面试突击非常有用,因为面试官最常考的算法题都在这本书里。如果你发现看这本书很吃力,可以先直接参考些网上的代码,照着抄一遍,理解下算法题是应该解题,多抄几道题目,你就对算法题的做法有感觉了,这个高考做固定套路数学题是一样的。
分类:
编程语言 时间:
2020-12-11 11:50:10
阅读次数:
13
Difficulty: Medium Related Topics: Array, Backtracking Link: https://leetcode.com/problems/word-search/ Description Given an m x n board and a word, f ...
分类:
其他好文 时间:
2020-12-10 11:30:28
阅读次数:
11
非商业,LeetCode链接附上: https://leetcode-cn.com/problems/longest-increasing-subsequence/ 进入正题。 题目: 给定一个无序的整数数组,找到其中最长上升子序列的长度。 示例: 输入: [10,9,2,5,3,7,101,18] ...
分类:
其他好文 时间:
2020-12-10 10:49:44
阅读次数:
2