PIXNET Logo登入

CONY的世界

跳到主文

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

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

  • 相簿
  • 部落格
  • 留言
  • 名片
  • 3月 22 週四 201804:20
  • Leetcode Tree,Linkedlist 114 @ Java

114. Flatten Binary Tree to Linked List
Given a binary tree, flatten it to a linked list in-place.
(繼續閱讀...)
文章標籤

angledark0123 發表在 痞客邦 留言(1) 人氣(367)

  • 個人分類:Algorithm medium
▲top
  • 3月 06 週二 201802:24
  • Leetcode DP 764 @ Java

764. Largest Plus Sign
In a 2D grid from (0, 0) to (N-1, N-1), every cell contains a 1, except those cells in the given list mines which are 0. What is the largest axis-aligned plus sign of 1s contained in the grid? Return the order of the plus sign. If there is none, return 0.
(繼續閱讀...)
文章標籤

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

  • 個人分類:Algorithm medium
▲top
  • 2月 27 週二 201812:56
  • Leetcode Greedy 316 @ Java

316. Remove Duplicate Letters
Given a string which contains only lowercase letters, remove duplicate letters so that every letter appear once and only once. You must make sure your result is the smallest in lexicographical order among all possible results.
(繼續閱讀...)
文章標籤

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

  • 個人分類:hard
▲top
  • 2月 27 週二 201810:13
  • Leetcode DP 140 @Java

140. Word Break II
Given a non-empty string s and a dictionary wordDict containing a list of non-empty words, add spaces in s to construct a sentence where each word is a valid dictionary word. You may assume the dictionary does not contain duplicate words.
(繼續閱讀...)
文章標籤

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

  • 個人分類:hard
▲top
  • 2月 21 週三 201812:45
  • Google CodeJam I/O for women 2/17- Graph-Centrist

題目落落長 https://codejam.withgoogle.com/codejam/contest/dashboard?c=8384486#s=p2
簡化來說就是要判斷如果是任意 字母排序,判斷某word 是否可以在中間
(繼續閱讀...)
文章標籤

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

  • 個人分類:google
▲top
  • 2月 19 週一 201801:26
  • Leetcode contest-2/17- BFS 785 @ Java

785. Is Graph Bipartite?
Given a graph, return true if and only if it is bipartite.
(繼續閱讀...)
文章標籤

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

  • 個人分類:Algorithm medium
▲top
  • 2月 10 週六 201803:38
  • Leetcode Math 670 @Java

670. Maximum Swap

Given a non-negative integer, you could swap two digits at most once to get the maximum valued number. Return the maximum valued number you could get.


Example 1:


Input: 2736
Output: 7236
Explanation: Swap the number 2 and the number 7.

 


Example 2:


Input: 9973
Output: 9973
Explanation: No swap.

 


Note:



  1. The given number is in the range [0, 108]


 


這邊的思維是loop from MSB到LSB,然後每位要用往後找是否有比自己更大的


(不能用往前看,找比自己小的最大位,因為無法確定目前的數字換完就是最大的


ex. 98368 --> 98863,如果用往前找小的,會變成98638,但是其實最佳的換法是8跟3 換)


所以要用小的數往後找最大值來看(因為9一定會讓值是最大,不管在哪位)


一但找到就可以swap 後return 


(繼續閱讀...)
文章標籤

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

  • 個人分類:Algorithm medium
▲top
  • 2月 09 週五 201816:01
  • Leetcode Graph 269 @Java

269. Alien Dictionary

(繼續閱讀...)
文章標籤

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

  • 個人分類:hard
▲top
  • 2月 09 週五 201801:37
  • Leetcode BFS 127 @ Java

127. Word Ladder
Given two words (beginWord and endWord), and a dictionary's word list, find the length of shortest transformation sequence from beginWord to endWord, such that:
(繼續閱讀...)
文章標籤

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

  • 個人分類:Algorithm medium
▲top
  • 2月 06 週二 201803:55
  • Leetcode UnionFind 261 @Java

261. Graph Valid Tree
Given n nodes labeled from 0 to n - 1 and a list of undirected edges (each edge is a pair of nodes), write a function to check whether these edges make up a valid tree.
(繼續閱讀...)
文章標籤

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

  • 個人分類:Algorithm medium
▲top
12...61»

個人資訊

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

Top Posts

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

文章精選

文章搜尋

誰來我家

參觀人氣

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