Given an array S of n integers, are there elements a, b, c, and d in S such that a + b + c + d = target? Find all unique quadruplets in the array which gives the sum of target.
罗马数字转换成阿拉伯数字 Roman to integer 给出一个罗马数字(字符串),返回此数字的阿拉伯数字(int) Given a roman numeral, convert it to an integer. Input is guaranteed to be within the range from 1 to 3999. example 1 {代码...} 思路 dict存储单个罗马字母代表的阿拉伯数字 初始状态sum = 0,循环遍历字...
阿拉伯数字转换成罗马数字 Integer to Roman 给出一个阿拉伯数字,返回此数字的罗马数字表示 Given an integer, convert it to a roman numeral. Input is guaranteed to be within the range from 1 to 3999. example 1 {代码...} 思路 用表记录关键的罗马数字和阿拉伯数字,将输入循环除以1000,900,500 ... 这些关键...
容器最大盛水量 Container With Most Water 给定n个非负整数a1,a2,...,an,其中每个表示坐标(i,ai)处的点。 绘制n条垂直线,使得线i的两个端点在(i,ai)和(i,0)处。 找到两条线,它们与x轴一起形成一个容器,使得容器含有最多的水。 注意:您不得倾斜容器,n至少为2。 Given n non-negative integers a1, a2,...
You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it as a linked list.
手动实现.*正则表达式匹配函数 regular expression matching '.' Matches any single character. '*' Matches zero or more of the preceding element. The matching should cover the entire input string (not partial). Some examples: {代码...} 思路 使用迭代,当p[1] != '*'每次判断p[0] == s[0]后令s = s[1:], p ...
Given two binary trees and imagine that when you put one of them to cover the other, some nodes of the two trees are overlapped while the others are not.
Notes: It is intended for this problem to be specified vaguely (ie, no given input specs). You are responsible to gather all the input requirements up front..