different loops in two dimensional array

I was trying to solve hackerrank questions. it has been long time I write anything directly related to arrays. mostly coding after some point is db related and mostly used lists there. anyway here is how you can solve https://www.hackerrank.com/challenges/diagonal-difference this question in O(n square) and O(n). import java.io.*; import java.util.*; public class Solution { public static void main(String[] args) { Scanner stdin = new Scanner(System.in); final int n = stdin.nextInt(); long sum = 0; long sum1 = 0; long[][] matris = new long[n][n]; for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { matris[i][j] = stdin.nextLong(); } } for (int i = 0; i < n; i++) { // System.out.println(matris[i][i]); sum += matris[i][i]; } for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { if (i + j == n - 1) { // System.out.println(matris[i][j]); sum1 += matris[i][j]; } } } for (int i = n - 1; i >= 0; i--) { System.out.println(matris[i][n - 1 - i]); } System.out.println(Math.abs(sum - sum1)); } }

February 11, 2016 · 1 min · Özkan Pakdil

adding jars to maven pom

normally you dont need this but sometime you may need to work with some special products like weblogic. and you may just need to add a dependincy from already installed weblogic. <dependency> <groupId>weblogic</groupId> <artifactId>weblogic</artifactId> <version>1</version> <scope>system</scope> <systemPath>C:\wl12\wlserver\modules\features\weblogic.server.merged.jar</systemPath> </dependency> this is working in windows as you guess :)

November 1, 2015 · 1 min · Özkan Pakdil