原创 Leetcode 134(Gas Station)

Question There are N gas stations along a circular route, where the amount of gas at station i is gas[i] . You hav

原创 Leetcode 343(Integer Break非動態規劃求解)

問題 Given a positive integer n, break it into the sum of at least two positive integers and maximize the product of

原创 LeetCode 119(Pascal's Triangle II)

Question Given an index k, return the kth row of the Pascal’s triangle. For example, given k=3 , Note: Could you optim

原创 Leetcode201(Bitwise AND of Numbers Range)

Question Given a range [m,n] where 0<=m<=n<=2147483647 , return the bitwise AND of all numbers in this range, inclusiv

原创 300. Longest Increasing Subsequence

Given an unsorted array of integers, find the length of longest increasing subsequence. For example, Given [10, 9, 2,

原创 Leetcode 137: (Single Number II)

Given an array of integers, every element appears three times except for one. Find that single one. Note: Your alg

原创 Leetcode135(Candy)

Question There are N children standing in a line. Each child is assigned a rating value. You are giving candies to thes

原创 Leetcode 264(Ugly Number II)

Question Write a program to find the nth ugly number. Ugly numbers are positive numbers whose prime factors only inclu

原创 Leetcode 142: Linked List Cycle II & Leetcode 287: Find the Duplicate Number

Leetcode 142: Given a linked list, return the node where the cycle begins. If there is no cycle, return null. Note

原创 Leetcode 64(Minimum Path Sum)

Question: Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right which minimize

原创 LeetCode 190(Reverse Bits)

Question Reverse bits of a given 32 bits unsigned integer. For example, given input 43261596 (represented in binary as

原创 關於robocode一些小感悟

     第一次認識robocode是在java課的課程設計上。第一次接觸它,就深深的被他吸引住了,並由此開始了robocode的學習歷程。      作爲一個普通學生,對robocode的理解當然不能同研究robocode的衆多專業人士

原创 LeetCode75(Sort Color)

問題 Given an array with n objects colored red, white or blue, sort them so that objects of the same color are adjacent,

原创 Dijkstra 算法示例

以上圖作爲示例,選取u爲源點,然後計算u到其他頂點的最短距離。 先假設dist[i]爲u到i的最短路徑的長度。\ cost[x,y]表示x到y的權值。 ①找出與u相鄰的頂點中距離最短的一條,得:dist[X]=1; ②和u或者x的最短路