PikachuBLOG


  • 首页

  • 分类

  • 归档

  • 标签

  • 搜索

LeetCode-CN 每日一题汇总

发表于 2020-06-24 | 分类于 LeetCode | 阅读次数
字数统计 1,301 | 阅读时长 5

Goog Good Study, Day Day Up……

阅读全文 »

70. Climbing Stairs

发表于 2019-12-16 | 分类于 LeetCode | 阅读次数
字数统计 288 | 阅读时长 1

70. Climbing Stairs

You are climbing a stair case. It takes n steps to reach to the top.

Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top?

阅读全文 »

69. Sqrt(x)

发表于 2019-12-16 | 分类于 LeetCode | 阅读次数
字数统计 448 | 阅读时长 2

69. Sqrt(x)

Implement int sqrt(int x).

Compute and return the square root of x, where x is guaranteed to be a non-negative integer.

Since the return type is an integer, the decimal digits are truncated and only the integer part of the result is returned.

阅读全文 »

50. Pow(x, n)

发表于 2019-12-03 | 分类于 LeetCode | 阅读次数
字数统计 361 | 阅读时长 2

50. Pow(x, n)

Implement pow(x, n), which calculates x raised to the power(x,n).

Example 1:

Input: 2.00000, 10
Output: 1024.00000

阅读全文 »

29. Divide Two Integers

发表于 2019-11-15 | 分类于 LeetCode | 阅读次数
字数统计 810 | 阅读时长 4

29. Divide Two Integers

Given two integers dividend and divisor, divide two integers without using multiplication, division and mod operator.

Return the quotient after dividing dividend by divisor.

The integer division should truncate toward zero.

Example 1:

Input: dividend = 10, divisor = 3
Output: 3

Example 2:

Input: dividend = 7, divisor = -3
Output: -2

Note:

Both dividend and divisor will be 32-bit signed integers.
The divisor will never be 0.
Assume we are dealing with an environment which could only store integers within the 32-bit signed integer range: [−231,  231 − 1]. For the purpose of this problem, assume that your function returns 231 − 1 when the division result overflows.
阅读全文 »

8. String to Integer (atoi)

发表于 2019-10-16 | 分类于 LeetCode | 阅读次数
字数统计 788 | 阅读时长 4

8. 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 character, takes an optional initial plus or minus sign followed by as many numerical digits as possible, and interprets them as a numerical value.

The string can contain additional characters after those that form the integral number, which are ignored and have no effect on the behavior of this function.

If the first sequence of non-whitespace characters in str is not a valid integral number, or if no such sequence exists because either str is empty or it contains only whitespace characters, no conversion is performed.

If no valid conversion could be performed, a zero value is returned.

阅读全文 »

9.Palindrome Number

发表于 2019-10-13 | 分类于 LeetCode | 阅读次数
字数统计 298 | 阅读时长 2

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

Input: -121

Output: false

Explanation: From left to right, it reads -121. From right to left, it becomes 121-. Therefore it is not a palindrome.

Example 3:

Input: 10

Output: false

Explanation: Reads 01 from right to left. Therefore it is not a palindrome.

Follow up:

Coud you solve it without converting the integer to a string?

阅读全文 »

7.Reverse Integer

发表于 2019-10-11 | 分类于 LeetCode | 阅读次数
字数统计 354 | 阅读时长 2

7. Reverse Integer

Given a 32-bit signed integer, reverse digits of an integer.

Example 1:

Input: 123

Output: 321

Example 2:

Input: -123

Output: -321

Example 3:

Input: 120

Output: 21

Note:
Assume we are dealing with an environment which could only store integers within the 32-bit signed integer range: [−231, 231 − 1]. For the purpose of this problem, assume that your function returns 0 when the reversed integer overflows.

阅读全文 »

CPU占用分析

发表于 2018-09-16 | 分类于 Java | 阅读次数
字数统计 588 | 阅读时长 2

一、概述

   当程序中出现死循环,或者计算量很大的线程的时候,就会导致Java程序进程占用大量CPU资源,从而可能导致程序挂掉,此文从实例进行概述具体的查询占用CPU资源高的程序代码。

阅读全文 »

G1垃圾收集器

发表于 2018-09-09 | 分类于 Java | 阅读次数
字数统计 4,528 | 阅读时长 17

一、概述

   本文主要通过对比G1(Garbage-Firs Collector)和CMS(Concurrent Mark-Sweep Collector)垃圾收集器的堆内存结构,以及具体垃圾收集过程,每个过程中是怎么扫描虚拟机堆,来阐述G1垃圾收集器的原理和具体优势。

   G1是一款面向服务器的垃圾收集器,主要针对配备多颗处理器及大容量内存的机器。以极高概率满足GC停顿时间要求的同时,还具备高吞吐量性能特征. 在Oracle JDK 7 update 4 及以上版本中得到完全支持, 专为以下应用程序设计:

  • 可以像CMS收集器一样,GC操作与应用的线程一起并发执行。
  • 紧凑的空闲内存区间且没有很长的GC停顿时间。
  • 需要可预测的GC暂停耗时。
  • 不想牺牲太多吞吐量性能。
  • 启动后不需要请求更大的Java堆。
    阅读全文 »
12…17
CodePikachu

CodePikachu

技术随笔

168 日志
5 分类
7 标签
RSS
GitHub Twitter 微博 知乎
0%
© 2015 - 2020 CodePikachu
博客全站共123.3k字
本站访客数:
由 Hexo 强力驱动
主题 - NexT.Pisces