Étiquettes » D.P.

We Are Number One

Now comes poet Robert Bringhurst, through an essay written for the esteemed Dark Mountain Project, and excerpted below. The images are from a… 6 mots de plus

Bearings

CREW CALL for Round Rock Feature Film "Crazy4You" [PAID]

Type of Production: Feature Length Film

Producer: Diego Antolini

Writer: Jonanthany Etrio

Director: Jonanthany Etrio

Project Description: 

A high school comedy feature film. Shooting from Monday December 12, 2016 – Thursday December 15, 2016 from 5-10PM at the CD Fulkes Middle School in Round Rock, TX. 31 mots de plus

Austin Cinemaker Space

[LC 368]. Largest Divisible Subset

DP的思路。需要同时track两个东东:到目前为止subset的size,和到目前为止subset是什么。

想了两种做法。第一种:用List<Integer>[] dp 记录到目前为止的subset,通过比较dp[i] 和 dp[j]的size,就可以知道当前subset的size。

举例说明:,dp开始是[[1], [2], [3], [6]];2可以整除1,dp变为[[1], , [3], [6]];3可以整除1,dp变为[[1], , , [6]];6可以整除1,2,3,但2和3对应的dp[]的size要比1对应的dp的size要大,所以把2(或3)对应的dp加到6对应的dp中,dp变成[[1], , , ]。最后结果是dp[i] 中size最大的元素。

第一种做法比较慢。第二种思路差不多,但用两个int[] 分别track目前subset的size和前一个元素的位置。一个是int[] count,初始值都是1,另一个int[] pre,初始值都是-1。

举例说明:, count开始是, 2可以整除1,count变成,pre变成[-1,0,-1,-1];3可以整除1,count变成, pre变成[-1,0,0,-1];6可以整除1,2,3,但count对应2或3的值大于对应1的值,所以count变成, pre变成[-1,0,0,1]。最后结果需要scan count和pre,先找出count中最大值对应的位置,然后从这个位置开始,从pre中找到之前一个应该在subset中的元素,直到找到全部subset中的元素。count的最大值也可以不在最后通过scan array找到,在之前update count和pre的过程中记录一下即可。 7 mots de plus

Leetcode

[LC 300]. Longest Increasing Subsequence

每遇到一个新的数字,可能会需要修改之前算好的结果,所以是典型的dp思路。

Example: nums =

比较好想的一种解法:int[] dp 存当前subsequence的最大可能长度,初始值所有元素都是1。对于例子来说,dp = 。算到 nums[2] = 3 时,3 < 5,略过,3 > 2,dp[2] = max(dp[0] + 1, dp[2]).这种解法需要O(n^2),因为每算一个dp[i],需要比较nums[i] 和 所有nums[0] – nums。 78 mots de plus

Leetcode

[LC85]|Maximal Rectangle

store the left boundary, right boundary and height of the rectangle that contains the current point. The key point is to cumulatively calculate the boundaries and height. 119 mots de plus

Leetcode

DP WANTED for Short Film "Dog Hair" [PAID]

Project Title: Dog Hair

Type of Production: Short  Film

Producer: Robert King

Writer: Chad Schnackel

Director: Robert King

Production Company: RK Film Co.

Project Description: 46 mots de plus

Austin Cinemaker Space

Community Film Studio

Community Film recently unveiled its own dedicated studio in school. It is already solving many of our logistical problems when it comes to having our own workplace and storing our equipment. 179 mots de plus

CAS