Elmagnifico's Blog

云深不知归处

LeetCode Solution(Easy.77-80)

c/c++,python,for work

77.Ransom Note 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...

LeetCode Solution(Easy.73-76)

c/c++,python,for work

73.Island Perimeter You are given a map in form of a two-dimensional integer grid where 1 represents land and 0 represents water. Grid cells are connected horizontally/vertically (not diagonally)....

LeetCode Solution(Easy.69-72)

c/c++,python,for work

69.Hamming Distance The Hamming distance between two integers is the number of positions at which the corresponding bits are different. Given two integers x and y, calculate the Hamming distance....

LeetCode Solution(Medium.17-20)

c/c++,python,for work

17.Unique Paths A robot is located at the top-left corner of a m x n grid (marked ‘Start’ in the diagram below). The robot can only move either down or right at any point in time. The robot is tr...

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...