随笔分类 - leetcode
摘要:Implement atoi to convert a string to an integer.Hint: Carefully consider all possible input cases. If you want a challenge, please do not see below a...
阅读全文
摘要:Reverse digits of an integer.Example1: x = 123, return 321Example2: x = -123, return -321click to show spoilers.Have you thought about this?Here are s...
阅读全文
摘要:Determine whether an integer is a palindrome. Do this without extra space.Some hints:Could negative integers be palindromes? (ie, -1)If you are thinki...
阅读全文
摘要:Given two binary strings, return their sum (also a binary string).For example,a = "11"b = "1"Return "100".char* addBinary(char* a, char* b) { int a...
阅读全文
摘要:Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum. F
阅读全文
摘要:Given two binary trees, write a function to check if they are equal or not.Two binary trees are considered equal if they are structurally identical an...
阅读全文
摘要: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 ↘ ...
阅读全文
摘要: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 -->...
阅读全文
摘要:Reverse a singly linked list./** * Definition for singly-linked list. * struct ListNode { * int val; * struct ListNode *next; * }; */struct Li...
阅读全文
摘要:一、题目Given an array and a value, remove all instances of that value in place and return the new length.The order of elements can be changed. It doesn't...
阅读全文
摘要:Given a non-negative number represented as an array of digits, plus one to the number.The digits are stored such that the most significant digit is at...
阅读全文

浙公网安备 33010602011771号