原创 LeetCode 514. 自由之路

514.自由之路 目錄 思路 代碼 複雜度分析 思路 構建一個映射表,記錄ring中每個下標向前向後到達每個字母的距離。然後BFS枚舉,只枚舉當前位置向前向後的到達目標字符,並記錄。 枚舉的時候採用了一些小優化,map的重複使用,以及只記

原创 LeetCode-Subsets-解題報告

原題鏈接 https://leetcode.com/problems/subsets/ Given a set of distinct integers, nums, return all possible subsets. Note

原创 LeetCode-Binary Tree Level Order Traversal-解題報告

原題鏈接 https://leetcode.com/problems/binary-tree-level-order-traversal/ Given a binary tree, return the level order trav

原创 LeetCode-Number of 1 Bits-解題報告

原題鏈接 https://leetcode.com/problems/number-of-1-bits/ Write a function that takes an unsigned integer and returns the n

原创 LeetCode-Permutations-解題報告

原題鏈接 https://leetcode.com/problems/permutations/ Given a collection of numbers, return all possible permutations. For

原创 LeetCode-Count Primes-解題報告

原題鏈接 https://leetcode.com/problems/count-primes/ Description: Count the number of prime numbers less than a non-negati

原创 LeetCode-Rotate Array-解題報告

原題鏈接 https://leetcode.com/problems/rotate-array/ Rotate an array of n elements to the right by k steps. For example, w

原创 LeetCode-Binary Tree Right Side View-解題報告

原題鏈接 https://leetcode.com/problems/binary-tree-right-side-view/ Given a binary tree, imagine yourself standing on the

原创 LeetCode-Bitwise AND of Numbers Range-解題報告

原題鏈接 https://leetcode.com/problems/bitwise-and-of-numbers-range/ Given a range [m, n] where 0 <= m <= n <= 2147483647,

原创 LeetCode-Remove Linked List Elements-解題報道

原題鏈接https://leetcode.com/problems/remove-linked-list-elements/ Remove all elements from a linked list of integers that

原创 LeetCode-Happy Number-解題報告

原題鏈接 https://leetcode.com/problems/happy-number/ Write an algorithm to determine if a number is "happy". A happy numbe

原创 LeetCode-Reverse Bits-解題報告

原題鏈接 https://leetcode.com/problems/reverse-bits/ Reverse bits of a given 32 bits unsigned integer. For example, given i

原创 LeetCode-Number of Islands-解題報告

原題鏈接 https://leetcode.com/problems/number-of-islands/ Given a 2d grid map of '1's (land) and '0's (water), count the n

原创 這幾天遇到的一些面試題

1.有8瓶藥,只有唯一的一瓶藥有效果,生效時間爲兩小時,如何用最少的試藥人在兩小時內找到這瓶藥。 首先想到的是最多肯定是7個人。 然後看題大概是一個人要吃幾瓶藥,才能減少人數,排列組合? 通過幾次試着寫,發現4個人可以解決,在寫的時候感覺

原创 windows8系統 出現不能關機和重啓 但是能夠休眠的問題

我猜測我的原因如下 昨天幫同學考資料,用了他的移動硬盤,然後出現了該磁盤卷有問題的提示,當時也沒怎麼管他,後來晚上關機的時候就出現不能關機,不能重啓, 但是可以休眠的問題。使用命令關機 也是不行的。 後來在網上看到一篇博客, http: