1. Maximum Sum of 3 Non-Overlapping Subarrays

    Leave a comment

    October 15, 2017 by oneOokay

    In a given array nums of positive integers, find three non-overlapping subarrays with maximum sum. Each subarray will be of size k, and …
    Continue reading

  2. Number of Distinct Islands

    Leave a comment

    October 8, 2017 by oneOokay

    问题在于如何存/translate an island so you can distinct them from each other. 我的代码跑过了所有700+个test case但是就是最后两个跑不过,而且test case太大不可能debug.最终拿了别人的pass的代码一个一个比较output才明白为什么我卡在最后两个test case了… 我的: main method里面 boolean[][] visited和String …
    Continue reading

  3. 265. Paint House II

    Leave a comment

    September 28, 2017 by oneOokay

    here are a row of n houses, each house can be painted with one of the k colors. The cost of painting each house …
    Continue reading

  4. Longest Consecutive Sequence

    Leave a comment

    September 28, 2017 by oneOokay

    Given an unsorted array of integers, find the length of the longest consecutive elements sequence. For example, Given [100, 4, 200, …
    Continue reading

  5. Task Scheduler

    Leave a comment

    September 28, 2017 by oneOokay

    Given a char array representing tasks CPU need to do. It contains capital letters A to Z where different letters …
    Continue reading

  6. H-Index

    Leave a comment

    September 25, 2017 by oneOokay

    Given an array of citations (each citation is a non-negative integer) of a researcher, write a function to compute the …
    Continue reading

  7. Pow(x, n)

    Leave a comment

    September 24, 2017 by oneOokay

    Implement pow(x, n). 不是很明白pow(x, n)到底在考什么. 首先pow(x, n)表示x的n次幂. power就是幂. 考点在于: 速度要快,不能就直接for loop单个数字相乘. power也是乘法,要用乘法的特性来提高算法效率.所以直接乘就会TLE n可以为正数也可以为负数.注意负数:Integer.MIN_VAUE:是 [ – (2的31次方)]. Integer.MAX_VALUE是[2的31次方 – 1].所以Integer.MIN_VALUE的绝对值是会大于Integer.MAX_VALUE的绝对值的. 这里某些算法会产生over flow. …
    Continue reading