LeetCode-Easy
文章平均质量分 73
曦曦慕慕
开开心心
展开
-
LeetCode 344:Reverse String (c++)
一:题目 Write a function that takes a string as input and returns the string reversed. Example: Given s = "hello", return "olleh". 二:题目分析 从字符串的结束为止,开始遍历,将其赋值给一个新的字符串 三:代码实现 class Solution { pub原创 2017-06-21 09:02:09 · 281 阅读 · 0 评论 -
LeetCode 345:Reverse Vowels of a String (c++)
一:题目 Write a function that takes a string as input and reverse only the vowels of a string. Example 1: Given s = "hello", return "holle". Example 2: Given s = "leetcode", return "leotcede".原创 2017-06-22 15:43:44 · 492 阅读 · 0 评论 -
Leetcode:Permutation Sequence
一:题目描述 The set[1,2,3,…,n]contains a total of n! unique permutations. By listing and labeling all of the permutations in order, We get the following sequence (ie, for n = 3): "123" "132" "21转载 2017-07-01 19:16:28 · 254 阅读 · 0 评论 -
LeetCode 383:Ransom Note (c++)
一:题目 Given an arbitrary ransom note string and another string containing letters from all the magazines, write a function that will return true if the ransom note can be constructed from the magazine原创 2017-06-22 15:03:06 · 322 阅读 · 0 评论 -
LeetCode 434:Number of Segments in a String (c++)
一:题目 Count the number of segments in a string, where a segment is defined to be a contiguous sequence of non-space characters. Please note that the string does not contain any non-printable charac原创 2017-06-22 10:55:07 · 277 阅读 · 0 评论 -
LeetCode 459: Repeated Substring Pattern (c++)
一:题目 Given a non-empty string check if it can be constructed by taking a substring of it and appending multiple copies of the substring together. You may assume the given string consists of lowerca原创 2017-06-22 09:32:29 · 524 阅读 · 0 评论 -
LeetCode 520:Detect Capital (c++)
一:题目 Given a word, you need to judge whether the usage of capitals in it is right or not. We define the usage of capitals in a word to be right when one of the following cases holds: All lett原创 2017-06-21 16:34:07 · 363 阅读 · 0 评论 -
LeetCode 521:Longest Uncommon Subsequence I (C++)
一:题目 Given a group of two strings, you need to find the longest uncommon subsequence of this group of two strings. The longest uncommon subsequence is defined as the longest subsequence of one of the原创 2017-06-21 16:25:23 · 247 阅读 · 0 评论 -
LeetCode 551:Student Attendance Record I (c++)
一:题目 You are given a string representing an attendance record for a student. The record only contains the following three characters: 'A' : Absent. 'L' : Late.'P' : Present. A student co原创 2017-06-21 10:47:02 · 262 阅读 · 0 评论 -
LeetCode 557:Reverse Words in a String III (c++)
一:题目 Given a string, you need to reverse the order of characters in each word within a sentence while still preserving whitespace and initial word order. Example 1: Input: "Let's take LeetCode原创 2017-06-21 10:24:30 · 512 阅读 · 0 评论 -
LeetCode 541:Reverse String II (c++)
一:题目 Given a string and an integer k, you need to reverse the first k characters for every 2k characters counting from the start of the string. If there are less than k characters left, reverse all o原创 2017-06-21 09:41:07 · 270 阅读 · 0 评论 -
LeetCode 606:Construct String from Binary Tree (c++)
一:题目分析 You need to construct a string consists of parenthesis and integers from a binary tree with the preorder traversing way. The null node needs to be represented by empty parenthesis pair "()"原创 2017-06-13 11:25:12 · 576 阅读 · 0 评论 -
LeetCode 125:Valid Palindrome(c++)
一:题目 Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases. For example, "A man, a plan, a canal: Panama" is a palindrome. "race a car" is原创 2017-06-21 08:33:24 · 388 阅读 · 0 评论 -
LeetCode 67:Add Binary (c++)
一:题目 Given two binary strings, return their sum (also a binary string). For example, a = "11" b = "1" Return "100". 二:解题分析 将只有'0,'1'的两个字符串进行二进制相加,即c代表a+b的结果 a b c 0 0 0原创 2017-06-22 16:45:52 · 337 阅读 · 0 评论