leetcode318.Maximum Product of Word Lengths
题目要求
1 | Given a string array words, find the maximum value of length(word[i]) * length(word[j]) where the two words do not share common letters. |
有一个字符串数组,从该字符串数组中找到两个字符串,要求满足这两个字符串之间没有相同的字母,同时它们的长度的乘积最大。
1 | Given a string array words, find the maximum value of length(word[i]) * length(word[j]) where the two words do not share common letters. |
有一个字符串数组,从该字符串数组中找到两个字符串,要求满足这两个字符串之间没有相同的字母,同时它们的长度的乘积最大。
1 | Median is the middle value in an ordered integer list. If the size of the list is even, there is no middle value. So the median is the mean of the two middle value. |
这里需要我们设计一个数据结构,使得我们可以从当前的字符流中获取中位数。
1 | Given a positive integer n, break it into the sum of at least two positive integers and maximize the product of those integers. |
将一个正整数分解为两个或两个以上的正整数,要求这些正整数的乘积最大。
1 | Given an unsorted array of integers, find the length of longest increasing subsequence. |
找到整数数组中最长的递增子数组。该子数组可以为不连续的。如题目中例子所示,[10, 9, 2, 5, 3, 7, 101, 18]得到的最长子数组为[2,3,7,101]。
1 | Given a singly linked list, group all odd nodes together followed by the even nodes. |
将一个链表中的节点按照奇数位上的节点在前,偶数位上的节点在后重新排序。
这里需要注意的是节点之间的相对顺序不可以改变。即1->2->3->4不可以变为1->3->4->2,只能是1->3->2->4。
1 | Given n balloons, indexed from 0 to n-1. Each balloon is painted with a number on it represented by array nums. You are asked to burst all the balloons. If the you burst balloon i you will get nums[left] * nums[i] * nums[right] coins. Here left and right are adjacent indices of i. After the burst, the left and right then becomes adjacent. |
这里讲了一个炸气球小游戏的规则。当我们选中一个气球并炸掉它后,会得到该气球以及其相邻两个气球的分数的乘积,并加入我们的积分。
之后该气球将消失,从而其左右两个气球成为相邻的气球。问如何选择气球才能使得积分数最高。
1 | Given two arrays of length m and n with digits 0-9 representing two numbers. Create the maximum number of length k <= m + n from digits of the two. The relative order of the digits from the same array must be preserved. Return an array of the k digits. You should try to optimize your time and space complexity. |
1 | Given a non negative integer number num. For every numbers i in the range 0 ≤ i ≤ num calculate the number of 1's in their binary representation and return them as an array. |
1 | Given an integer matrix, find the length of the longest increasing path. |
1 | You are given an integer array nums and you have to return a new counts array. |
输入一个整数数组nums[i],返回所有一个新的数组count,该数组第i位上的count[i]表示nums[i]右侧小于nums[i]的数字的个数。