PIXNET Logo登入

CONY的世界

跳到主文

在這裡我不是要向大家講述我的生活,只是想留著一些回憶

部落格全站分類:生活綜合

  • 相簿
  • 部落格
  • 留言
  • 名片
  • 1月 03 週三 201807:13
  • Leetcode 69, @ Java

 69. Sqrt(x)

Implement int sqrt(int x).
Compute and return the square root of x.
x is guaranteed to be a non-negative integer.


Example 1:
Input: 4
Output: 2

 
Example 2:
Input: 8
Output: 2
Explanation: The square root of 8 is 2.82842..., and since we want to return an integer, the decimal part will be truncated.

 
 這題我只想到暴力解,所以就直接放棄看解答了,解法非常有趣
用BFS,不斷逼近正確的區段,因為有可能不是整數,最後確定數值是用 if(mid+1 > x/(mid+1)) 來判斷  (來確定下個值會過大,正解就是這個值)
(繼續閱讀...)
文章標籤

angledark0123 發表在 痞客邦 留言(0) 人氣(17)

  • 個人分類:easy
▲top
  • 1月 02 週二 201809:04
  • Leetcode 88 @ Java

88. Merge Sorted Array
Given two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array.
(繼續閱讀...)
文章標籤

angledark0123 發表在 痞客邦 留言(0) 人氣(16)

  • 個人分類:easy
▲top
  • 1月 01 週一 201806:07
  • Leetcode 234,680 @ Java

 234. Palindrome Linked List
Given a singly linked list, determine if it is a palindrome.
Follow up:
Could you do it in O(n) time and O(1) space?
(繼續閱讀...)
文章標籤

angledark0123 發表在 痞客邦 留言(0) 人氣(6)

  • 個人分類:easy
▲top
  • 12月 31 週日 201713:03
  • Leetcode 283 @ Java

283. 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.
(繼續閱讀...)
文章標籤

angledark0123 發表在 痞客邦 留言(0) 人氣(13)

  • 個人分類:easy
▲top
  • 12月 30 週六 201711:47
  • Leetcode Math 13 @ Java

13. Roman to Integer

Given a roman numeral, convert it to an integer.
Input is guaranteed to be within the range from 1 to 3999.
(繼續閱讀...)
文章標籤

angledark0123 發表在 痞客邦 留言(0) 人氣(12)

  • 個人分類:easy
▲top
1

個人資訊

angledark0123
暱稱:
angledark0123
分類:
生活綜合
好友:
累積中
地區:

Top Posts

  • (852)我不知道風是在哪一個方向吹 徐志摩
  • (159)寫程式語言人的痛(同感)
  • (392)「大考大玩,小考小玩」的真實意義
  • (48)終章---費玉清 唱
  • (330)台北Mei’s Tea Bar ~好吃又特別的蘋果鬆餅
  • (1,599)" 食物GI值 " 的大整理
  • (7)兩天一夜台北遊 part1 -元定食
  • (16,611)什麼是Library(函式庫,大陸稱庫)
  • (275)fedora快捷鍵
  • (103)[轉載]android ndk翻译之八:Bionic C 库一览(二)

文章分類

toggle leetcode (3)
  • Algorithm medium (32)
  • easy (5)
  • hard (6)
  • google (1)
  • 拜家 (4)
  • 學習 (102)
  • 生活隨筆 (49)
  • 旅遊 (16)
  • 美食 (9)
  • 未分類文章 (1)

最新文章

  • Leetcode Tree,Linkedlist 114 @ Java
  • Leetcode DP 764 @ Java
  • Leetcode Greedy 316 @ Java
  • Leetcode DP 140 @Java
  • Google CodeJam I/O for women 2/17- Graph-Centrist
  • Leetcode contest-2/17- BFS 785 @ Java
  • Leetcode Math 670 @Java
  • Leetcode Graph 269 @Java
  • Leetcode BFS 127 @ Java
  • Leetcode UnionFind 261 @Java

文章精選

文章搜尋

誰來我家

參觀人氣

  • 本日人氣:
  • 累積人氣: