09 2018 档案
发表于 2018-09-30 22:00阅读:118评论:0推荐:0
摘要:Given an array nums of n integers, are there elements a, b, c in nums such that a + b + c = 0? Find all unique triplets in the array which gives the s
阅读全文 »
发表于 2018-09-30 20:48阅读:171评论:0推荐:0
摘要:Roman numerals are represented by seven different symbols: I, V, X, L, C, D and M. For example, two is written as II in Roman numeral, just two one's
阅读全文 »
发表于 2018-09-30 09:19阅读:187评论:0推荐:0
摘要:Given n non-negative integers a1, a2, ..., an , where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endp
阅读全文 »
发表于 2018-09-30 08:33阅读:156评论:0推荐:0
摘要:Given an input string (s) and a pattern (p), implement regular expression matching with support for '.' and '*'. The matching should cover the entire
阅读全文 »
发表于 2018-09-28 21:17阅读:185评论:0推荐:0
摘要:Determine whether an integer is a palindrome. An integer is a palindrome when it reads the same backward as forward. Example 1: Example 2: Example 3:
阅读全文 »
发表于 2018-09-28 17:47阅读:178评论:0推荐:0
摘要:The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font
阅读全文 »
发表于 2018-09-27 22:29阅读:161评论:0推荐:0
摘要:Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000. Example 1: Example 2: AC code: std
阅读全文 »
发表于 2018-09-27 17:18阅读:147评论:0推荐:0
摘要:There are two sorted arrays nums1 and nums2 of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity sh
阅读全文 »
发表于 2018-09-27 16:50阅读:145评论:0推荐:0
摘要:Given a string, find the length of the longest substring without repeating characters. Example 1: Input: "abcabcbb" Output: 3 Explanation: The answer
阅读全文 »
发表于 2018-09-27 16:35阅读:158评论:0推荐:0
摘要: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 contai
阅读全文 »
发表于 2018-09-25 17:19阅读:909评论:0推荐:0
摘要:本题要求实现一个函数,找到并返回链式表的第K个元素。 函数接口定义: ElementType FindKth( List L, int K ); 其中List结构定义如下: typedef struct LNode *PtrToLNode; struct LNode { ElementType Da
阅读全文 »
发表于 2018-09-25 17:04阅读:840评论:0推荐:0
摘要:本题要求实现一个函数,求链式表的表长。 函数接口定义: 其中List结构定义如下: L是给定单链表,函数Length要返回链式表的长度。 裁判测试程序样例: 输入样例: 输出样例: AC code:
阅读全文 »
发表于 2018-09-25 17:01阅读:1631评论:1推荐:1
摘要:本题要求实现顺序表的操作集。 函数接口定义: 其中List结构定义如下: 各个操作函数的定义为: List MakeEmpty():创建并返回一个空的线性表; Position Find( List L, ElementType X ):返回线性表中X的位置。若找不到则返回ERROR; bool I
阅读全文 »
发表于 2018-09-25 16:19阅读:3287评论:3推荐:0
摘要:本题要求实现一个函数,将给定的单链表逆转。 函数接口定义: List Reverse( List L ); 其中List结构定义如下: typedef struct Node *PtrToNode; struct Node { ElementType Data; /* 存储结点数据 */ PtrTo
阅读全文 »
发表于 2018-09-23 17:11阅读:309评论:0推荐:0
摘要:K的因子中只包含2 3 5。满足条件的前10个数是:2,3,4,5,6,8,9,10,12,15。 所有这样的K组成了一个序列S,现在给出一个数n,求S中 >= 给定数的最小的数。 例如:n = 13,S中 >= 13的最小的数是15,所以输出15。 Input Output Input示例 Out
阅读全文 »
发表于 2018-09-23 15:40阅读:282评论:0推荐:1
摘要:将一堆正整数分为2组,要求2组的和相差最小。 例如:1 2 3 4 5,将1 2 4分为1组,3 5分为1组,两组和相差1,是所有方案中相差最少的。 Input Output Input示例 Output示例 分成两组当两组的数据都趋向于算术平均值的时候此时的差值最小,res来表示一个背包,背包的空
阅读全文 »