一种双核CPU的两个核能够同时的处理任务,现在有n个已知数据量的任务需要交给CPU处理,假设已知CPU的每个核1秒可以处理1kb,每个核同时只能处理一项任务。n个任务可以按照任意顺序放入CPU进行处理,现在需要设计一个方…
分类:LeetCode
LeetCode算法题-Range Addition II(Java实现)
这是悦乐书的第271次更新,第285篇原创 01 看题和准备 今天介绍的是LeetCode算法题中Easy级别的第138题(顺位题号是598)。给定一个m行n列的新二维数组M,其初始值为0。提供一个二维数组ops,每次对…
[剑指offer] 机器人的运动范围
本文首发于我的个人博客:尾尾部落 题目描述 地上有一个m行和n列的方格。一个机器人从坐标0,0的格子开始移动,每一次只能向左,右,上,下四个方向移动一格,但是不能进入行坐标和列坐标的数位之和大于k的格子。 例如,当k为1…
543. Diameter of Binary Tree
Easy 跟之前做过的有一道题很像,也是用height() method写,但是并不是返回height, 只是在求height的过程中更新了需要求的那个变量 /** * Definition for a binary t…
Leetcode 168. Excel Sheet Column Title
Given a positive integer, return its corresponding column title as appear in an Excel sheet. For example: 1 -&…
[LeetCode] Substring with Concatenation of All Words 串联所有单词的子串
You are given a string, s, and a list of words, words, that are all of the same length. Find all starti…
[LeetCode] Binary Tree Zigzag Level Order Traversal 二叉树的之字形层序遍历,[LeetCode] Binary Tree Level Order Traversal 二叉树层序遍历
Given a binary tree, return the zigzag level order traversal of its nodes’ values. (ie,…
[LeetCode] Matchsticks to Square 火柴棍组成正方形
Remember the story of Little Match Girl? By now, you know exactly what matchsticks the little match gir…
[LeetCode] Minimum Time Difference 最短时间差
Given a list of 24-hour clock time points in “Hour:Minutes” format, find the minimum m…
[LeetCode] Toeplitz Matrix 托普利兹矩阵
A matrix is Toeplitz if every diagonal from top-left to bottom-right has the same element. No…
LeetCode | Subsets
题目: Given a set of distinct integers, S, return all possible subsets. Note: Elements in a subset must be …
LeetCode之Graph题目汇总
Course Schedule There are a total of n courses you have to take, labeled from 0 to n …