LeetCode
dracarys~
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
这才是高效判断素数的正确打开方式
这才是高效判断素数的正确打开方式什么是素数问题代码 什么是素数 素数也被称为质数,定义为在大于1的自然数中bai,除了1和它本身以外不再有其他因数。 问题 统计所有小于非负整数 n 的质数的数量。 代码 class Solution { int countPrimes(int n) { boolean[] isPrim = new boolean[n];//数组默认为false for (int i = 2; i * i < n; i++)原创 2020-10-30 17:52:09 · 180 阅读 · 0 评论 -
LeetCode:Roman to Integer
Roman numerals are represented by seven different symbols: I, V, X, L, C, D and M. Symbol Value I 1 V 5 X 10 L 50 C 100 D 5...原创 2019-04-07 02:16:37 · 190 阅读 · 0 评论 -
LeetCode:String to Integer (atoi)
Implement atoi which converts a string to an integer. The function first discards as many whitespace characters as necessary until the first non-whitespace character is found. Then, starting from this...原创 2019-04-08 01:20:42 · 210 阅读 · 0 评论 -
Palindrome Number 判断是否为回文数
Palindrome Number 判断是否为回文数问题描述解答思路 问题描述 Determine whether an integer is a palindrome. An integer is a palindrome when it reads the same backward as forward. Example 1: Input:121 Output:true Example 2:...原创 2019-04-03 01:43:58 · 526 阅读 · 0 评论 -
LeetCode:Longest Common Prefix
Write a function to find the longest common prefix string amongst an array of strings. If there is no common prefix, return an empty string “”. Example 1: Input: [“flower”,“flow”,“flight”] Output: “fl...原创 2019-04-09 01:47:11 · 201 阅读 · 0 评论 -
LeetCode:Merge Two Sorted Lists
题目: Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists. Example: Input: 1->2->4, 1->3->4 Output: 1...原创 2019-04-14 02:01:32 · 232 阅读 · 0 评论
分享