Elmagnifico's Blog

云深不知归处

LeetCode Solution(Medium.13-16)

c/c++,python,for work

13.Integer to Roman Given an integer, convert it to a roman numeral. Input is guaranteed to be within the range from 1 to 3999. 13.Integer to Roman-Analysis 这个是要求把整数转换成罗马数字。和之前的easy系列中的14题是相反的 ...

LeetCode Solution(Medium.9-12)

c/c++,python,for work

9.Search Insert Position Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order. You may assume ...

LeetCode Solution(Medium.5-8)

c/c++,python,for work

5.Binary Tree Preorder Traversal Given a binary tree, return the preorder traversal of its nodes’ values. For example: Given binary tree {1,#,2,3}, 1 \ 2 / 3 return [1,2,3]....

LeetCode Solution(Medium.1-4)

c/c++,python,for work

前言 从本篇开始,做所有Medium难度的题目 1.Single Number Given an array of integers, every element appears twice except for one. Find that single one. Note: Your algorithm should have a linear runtime complexit...

LeetCode Solution(Easy.65-68)

c/c++,python,for work

65.Excel Sheet Column Title Given a positive integer, return its corresponding column title as appear in an Excel sheet. For example: 1 -> A 2 -> B 3 -> C ... 26 -> Z 27 -> AA 28 ...

LeetCode Solution(Easy.61-64)

c/c++,python,for work

61.Count Primes Description: Count the number of prime numbers less than a non-negative number, n. Credits: Special thanks to @mithmatt for adding this problem and creating all test cases. Hin...

LeetCode Solution(Easy.57-60)

c/c++,python,for work

57.Implement strStr() Implement strStr(). Returns the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack. 57.Implement strStr()-Analysis 判断一个字符串是否是另外一个...

LeetCode Solution(Easy.53-56)

c/c++,python,for work

53.Add Binary Given two binary strings, return their sum (also a binary string). For example a = "11" b = "1" Return “100”. 53.Add Binary-Analysis 给二进制的string 然后求和 还能更简单吗? 方法一把string的二进制直接转...

LeetCode Solution(Easy.49-52)

c/c++,python,for work

49.Count and Say The count-and-say sequence is the sequence of integers beginning as follows: 1, 11, 21, 1211, 111221, ... 1 is read off as "one 1" or 11. 11 is read off as "two 1s" or 21. 21 is...

LeetCode Solution(Easy.45-48)

c/c++,python,for work

45.Remove Nth Node From End of List Given a linked list, remove the nth node from the end of list and return its head. For example, Given linked list: 1->2->3->4->5, and n = 2. Afte...