class: center middle
<style> .remark-code { white-space: pre-wrap; } </style>Given a target sum and an array of positive integers, return true if any combination of numbers in the array can add to the target. Each number in the array may only be used once. Return false if the numbers cannot be used to add to the target sum.
subsetSum(2, [1, 10, 5, 3]); // false
subsetSum(10, [1, 10, 5, 3]); // true
subsetSum(9, [1, 10, 5, 3]); // true
Write a function that determines whether an input string has balanced brackets.
You are given an input string consisting of brackets—square [ ]
, round ( )
, and curly { }
. The input string can include other text. Write a function that returns either true
if the brackets in the input string are balanced or false
if they are not. Balanced means that any opening bracket of a particular type must also have a closing bracket of the same type.