We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Ema's Supercomputer
Ema's Supercomputer
Sort by
recency
|
318 Discussions
|
Please Login in order to post a comment
Here is problem solution in python java c++ c and Javascript - https://programmingoneonone.com/hackerrank-emas-supercomputer-problem-solution.html
/* Helper functions. */ public static String point(int x, int y) { return String.format("%d,%d", x, y); } public static String point(int[] p) { return String.format("%d,%d", p[0], p[1]); } public static int[] add(int[] a, int[] b) { return new int[]{a[0] + b[0], a[1] + b[1]}; }
An alternative Python solution:
My Python solution:
After all, the best method is brute force. The idea is simple, you only need to travese the grid to find possible plus and then loop through these valid pluses to get the max product. Here is my js for the function. It might not be optimized, so feel free to upgrade it further.