@@ -0,0 +1,1084 @@
+package mylab.puzzles;%0A%0A/**%0A * Minimum Horizontal Strokes%0A *%0A * Sample input:%0A * A%5B%5D = new int%5B%5D%7B1,1,1,1%7D%0A * Output:%0A * 1%0A *%0A * Sample input:%0A * A%5B%5D = new int%5B%5D%7B1,3,2,1,2,1,5,3,3,4,2%7D%0A * Output:%0A * 9%0A *%0A * If strokes %3E 1,000,000,000 then return -1%0A *%0A * http://stackoverflow.com/questions/33399211/how-to-find-least-strokes-required-to-paint-a-skyline-with-time-and-storage-comp%0A *%0A */%0A%0Apublic class MinHorizontalStrokes %7B%0A%0A%09%09public int solve(int A%5B%5D) %7B%0A        int level = 0;%0A        int strokes = 0;%0A%0A        for (int i = 0;i %3C A.length;i++) %7B%0A            if (A%5Bi%5D %3E level) %7B%0A                strokes += A%5Bi%5D - level;%0A                level = A%5Bi%5D;%0A            %7D else if (A%5Bi%5D %3C level) %7B%0A                level = A%5Bi%5D;%0A            %7D%0A%0A            if (strokes %3E 1000000000)%0A                return -1;%0A      %09%7D%0A      %09return strokes;%0A%09%09%7D%0A%0A%09%09public static void main(String%5B%5D args) %7B%0A%09%09%09%09MinHorizontalStrokes problem = new MinHorizontalStrokes();%0A%09%09%09%09System.out.println(problem.solve(new int%5B%5D%7B 1,1,1,1 %7D));%0A%09%09%09%09System.out.println(problem.solve(new int%5B%5D%7B 1,3,2,1,2,1,5,3,3,4,2 %7D));%0A%09%09%7D%0A%0A%7D%0A

Add puzzle from OrionHealth interview question taken from codility.com