0w1

Entries from 2016-09-12 to 1 day

Classic Optimal Parentheses Inserting ( DP )

Problem Description: Given an arithmetic sequence, add parentheses freely to create the maximal outcome. For example, the optimal way to add parentheses for: 5-8+7*4-8+9 would be: 200 = (5 − ((8 + 7) × (4 − (8 + 9))))Constraints: 1. Only +…

Classic Edit Distance ( DP )

Problem Description: Given 2 strings, output the minimal edit distance between them. There are 3 valid operations, each with cost of 1. 1. Delete a character. 2. Insert a character. 3. Replace a character. The objective is to make both str…

UVA 10245 - The Closest Pair Problem ( D&C )

UVa Online Judge I have read a few good sites for reference. phoenixzhao.github.io http://apir8181.github.io/algorithm/2014/10/02/closest_pair.html A very classic problem for divide and conquer. There are 3 ways to solve this, with D&C ( O…