jykim16
9/21/2017 - 5:03 PM

https://leetcode.com/problems/russian-doll-envelopes/description/

//did not complete

/**
 * @param {number[][]} envelopes
 * @return {number}
 */
var maxEnvelopes = function(envelopes) {
    let max = 0;
    let sortedByHeightEnvelopes = envelopes.sort((a,b)=>{return a[0] < b[0]});
    let recurseHeight = (currentHeight, remainingEnvelopes, currentCount) => {
        var categorizeByHeight = findNextHeightGroup(currentHeight, remainingEnvelopes);
        let nextGroupOfEnvelopes = categorizeByHeight[0];
        let remainingEnvelopes = categorizeByHeight[1]
    }
    let findNextHeightGroup = (currentHeight, remainingEnvelopes) => {
        let results = [];
        let nextHeight; 
        for (let i = 0; i < remainingEnvelopes.length; i++) {
            if(!nextHeight) {
               if(remainingEnvelopes[i][0] > currentHeight) {
                   nextHeight = remainingEnvelopes[i][0];
                   results.push(remainingEnvelopes[i]);
               }
            } else if (remainingEnvelopes[i][0] === nextHeight) {
                results.push(remainingEnvelopes[i])
            } 
        }
        return results;
    }
    
    return max;
};