전체 글
-
[LeetCode] [DP] 746. Min Cost Climbing StairsAlgorithm/LeetCode 2021. 10. 8. 10:11
You are given an integer array cost where cost[i] is the cost of ith step on a staircase. Once you pay the cost, you can either climb one or two steps. You can either start from the step with index 0, or the step with index 1. Return the minimum cost to reach the top of the floor. Example 1: Input: cost = [10,15,20] Output: 15 Explanation: Cheapest is: start on cost[1], pay that cost, and go to ..
-
[LSTM] return_sequence = True or FalseImplementation/Text 2021. 10. 5. 13:42
### dec_hidden 값을 decoder 즉, lstm layer 에 통과시켰을 때, # return_sequence = True or False 에 따른 변경. dec_hidden.shape >>> (2,10,4) # return_sequence = False 일 때, dec_lstm = tf.keras.layers.LSTM(units= 5, return_sequence=False) dec_hidden = dec_lstm(dec_hidden, initial_state=[enc_h_state, enc_c_state], mask=dec_mask) dec_hidden.shape >>> (2,5) # return sequence = True 일 때, dec_lstm = tf.keras.layers.LST..
-
[LeetCode] [DP] 53. Maximum SubarrayAlgorithm/LeetCode 2021. 10. 5. 08:56
Given an integer array nums, find the contiguous subarray (containing at least one number) which has the largest sum and return its sum. A subarray is a contiguous part of an array. Example 1: Input: nums = [-2,1,-3,4,-1,2,1,-5,4] Output: 6 Explanation: [4,-1,2,1] has the largest sum = 6. Example 2: Input: nums = [1] Output: 1 Example 3: Input: nums = [5,4,-1,7,8] Output: 23 Constraints: 1