leetcode
lovenoodles
这个作者很懒,什么都没留下…
展开
-
[Easy] [leetcode面试] moveZeroes java方案, 使用main函数测试
原题目: https://leetcode.com/problems/move-zeroes/ Given an array nums, write a function to move all 0's to the end of it while maintaining the relative order of the non-zero elements. Example: Input...原创 2018-11-29 00:04:44 · 218 阅读 · 0 评论 -
[Easy] [leetcode面试] reverseString java版本
原题目: https://leetcode.com/problems/reverse-string/ Write a function that takes a string as input and returns the string reversed. Example 1: Input: "hello" Output: "olleh" Example 2: Input:...原创 2018-11-29 22:26:22 · 131 阅读 · 0 评论 -
[easy][leetcode面试] Fizz Buzz js方法 && java方法
Write a program that outputs the string representation of numbers from 1 to n. But for multiples of three it should output “Fizz” instead of the number and for the multiples of five output “Buzz”. Fo...原创 2018-12-04 22:54:55 · 212 阅读 · 0 评论 -
[easy][leetcode面试题] Maximum Depth of Binary Tree
Given a binary tree, find its maximum depth. The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node. Note: A leaf is a node with no childre...原创 2018-12-05 22:53:55 · 105 阅读 · 0 评论 -
[easy][leetcode面试] reverseList 反转单链表
Reverse a singly linked list. Example: Input: 1->2->3->4->5->NULL Output: 5->4->3->2->1->NULL Follow up: A linked list can be reversed either iteratively or recursi...原创 2018-12-12 23:27:11 · 119 阅读 · 0 评论 -
[easy][leetcode面试] majorityElement 的js解法
Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times. You may assume that the array is non-empty and the majority element alwa...原创 2018-12-19 16:40:49 · 151 阅读 · 0 评论 -
[easy][leetcode面试] Single Number
Given a non-empty array of integers, every element appears twice except for one. Find that single one. Note: Your algorithm should have a linear runtime complexity. Could you implement it without us...原创 2018-12-06 23:08:49 · 99 阅读 · 0 评论 -
[easy][leetcode面试] sum-of-two-integers && js 中 有符号 int 的二进制表示
Calculate the sum of two integers a and b, but you are not allowed to use the operator + and -. Example 1: Input: a = 1, b = 2 Output: 3 Example 2: Input: a = -2, b = 3 Output: 1 js推荐方法: /**...原创 2018-12-11 22:11:10 · 158 阅读 · 0 评论 -
[easy][leetcode面试] 罗马字符转换成对应的数字
Roman numerals are represented by seven different symbols: I, V, X, L, C, Dand M. Symbol Value I 1 V 5 X 10 L 50 C 100 D ...原创 2018-12-18 23:05:39 · 241 阅读 · 0 评论