125. Valid Palindrome【easy】】的更多相关文章

125. Valid Palindrome[easy] 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 not a palindrome. No…
680. Valid Palindrome II[easy] Given a non-empty string s, you may delete at most one character. Judge whether you can make it a palindrome. Example 1: Input: "aba" Output: True Example 2: Input: "abca" Output: True Explanation: You co…
234. Palindrome Linked List[easy] Given a singly linked list, determine if it is a palindrome. Follow up:Could you do it in O(n) time and O(1) space? 解法一: /** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * Lis…
661. Image Smoother[easy] Given a 2D integer matrix M representing the gray scale of an image, you need to design a smoother to make the gray scale of each cell becomes the average gray scale (rounding down) of all the 8 surrounding cells and itself.…
657. Judge Route Circle[easy] Initially, there is a Robot at position (0, 0). Given a sequence of its moves, judge if this robot makes a circle, which means it moves back to the original place. The move sequence is represented by a string. And each m…
2. Trailing Zeros[easy] Write an algorithm which computes the number of trailing zeros in n factorial. Have you met this question in a real interview? Yes Example 11! = 39916800, so the out should be 2 Challenge O(log N) time 解法一: class Solution { /*…
170. Two Sum III - Data structure design[easy] Design and implement a TwoSum class. It should support the following operations:add and find. add - Add the number to an internal data structure.find - Find if there exists any pair of numbers which sum…
160. Intersection of Two Linked Lists[easy] Write a program to find the node at which the intersection of two singly linked lists begins. For example, the following two linked lists: A: a1 → a2 ↘ c1 → c2 → c3 ↗ B: b1 → b2 → b3 begin to intersect at n…
206. Reverse Linked List[easy] Reverse a singly linked list. Hint: A linked list can be reversed either iteratively or recursively. Could you implement both? 解法一: class Solution { public: ListNode* reverseList(ListNode* head) { ListNode * pre = NULL;…
203. Remove Linked List Elements[easy] Remove all elements from a linked list of integers that have value val. ExampleGiven: 1 --> 2 --> 6 --> 3 --> 4 --> 5 --> 6, val = 6Return: 1 --> 2 --> 3 --> 4 --> 5 Credits:Special than…