原创 Leetcode 207 Course Schedule(第五週作業)

先貼原題: There are a total of n courses you have to take, labeled from 0 to n - 1. Some courses may have prerequisit

原创 Leetcode ArrayNesting(第一週作業)

先貼原題: A zero-indexed array A consisting of N different integers is given. The array contains all integers in the rang

原创 Leetcode 392.Is Subsequence(第十一週作業)

首先貼出原題 Given a string s and a string t, check if s is subsequence of t. You may assume that there is only lower case E

原创 Leetcode 200.Number of Islands(第三週作業)

本週學習了圖論,最重要的是講了兩種搜索方法,分別是深度優先搜索和廣度優先搜索。於是在leetcode上看到了這樣一道很有意思的題目。數孤島的數目。 先貼原題~ 我的思路是:從第一個點開始便利整個矩陣,利用深度優先搜索,即找這個點

原创 Leetcode 494.Target Sum(第十五週作業)

先貼原題: You are given a list of non-negative integers, a1, a2, …, an, and a target, S. Now you have 2 symbols + and -.

原创 Leetcode 215. Kth Largest Element in an Array(第二週作業)

先貼原題: 題意爲:給出一個無序數組,然後指定一個整數值K,我們需要找出第k大的元素。 使用書上給出的方法:隨便選擇一個元素(我選擇第size/2的元素),然後遍歷數組,比這個元素小的丟到左邊,比這個元素大的丟到右邊,與元素相等的也記

原创 Leetcode 169. Majority Element (第四周作業)

這周,我做了一道上課的時候老師講過的衆數的問題,不過我做得是easy級別的,下週我會做medium級別的。 先貼一下題意 衆數的定義爲一個數組中,這個數字出現超過總數的1/2,即爲衆數。 我選擇偷個懶,用java的hashmap做這道

原创 Leetcode120 Triangle (第八週作業)

這周依然是動態規劃的題目~~~先貼原題: Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacen

原创 Leetcode 673 Number of Longest Increasing Subsequence(第六週作業)

這周學了動態規劃,我瀏覽leetcode的題目時,發現了一道和課上講的題目名字很像的一道題。 一開始我以爲是尋找最長子序列的長度就好,結果定睛一看:不是!!是尋找最長子序列的個數。這完全就不是一道題了,這在尋找最大長度的基礎上加大了難

原创 Leetcode 718. Maximum Length of Repeated Subarray(第九周作業)

因爲自己的動態規劃能力真的太差了,所以這次還是動態規劃題。 這次選用了一道比較經典的題目:最長公共子串,首先貼出原題。 Given two integer arrays A and B, return the maximum length

原创 Leetcode 55 Jump Game(第七週作業)

上週學習了貪心算法,於是去百度了一下比較有名的leetcode的貪心算法的題目,發現這道題目還是挺經典的。 首先貼出原題 意思就是給出一個數組,每個元素的值代表可以從這個位置走出去的最大距離。問這個數組能不能走到最後一個元素的位置。

原创 Leetcode 5. Longest Palindromic Substring (第十週作業)

這周依然是動態規劃的題目。 先貼原題: Given a string s, find the longest palindromic substring in s. You may assume that the maximum len

原创 Leetcode 75.Sort Colors(第十二週作業)

先貼原題: Given an array with n objects colored red, white or blue, sort them so that objects of the same color are adjac

原创 軟件架構與框架

描述軟件架構與框架之間的區別與聯繫定義:軟件架構:軟件架構是一個系統的草圖。軟件架構描述的對象是直接構成系統的抽象組件。各個組件之間的連接則明確和相對細緻地描述組件之間的通訊。設計軟件架構就是把系統分解爲一些部件,描述這些部件的職責及它們

原创 Leetcode 740.Delete and Earn(第十六週作業)

先貼原題: Given an array nums of integers, you can perform operations on the array. In each operation, you pick any num