Skip to content

Instantly share code, notes, and snippets.

View ajgupta's full-sized avatar

Ajay Gupta ajgupta

  • Infosys Ltd.
  • India
View GitHub Profile
@ajgupta
ajgupta / VMWare_solution
Created October 31, 2014 11:28
HackerRank challenge during VMWare Evaluation
public class Vmware {
public static void main(String[] args) {
int[] a= new int[args.length];
for (int i=0;i<args.length; i++){
a[i]= Integer.parseInt(args[i]);
}
int maxnum=flip(a);
System.out.println(maxnum);
@ajgupta
ajgupta / VMWare_question
Created October 31, 2014 11:18
HackerRank challenge during VMWare Evaluation
You are given an integer array with N elements: d[0], d[1], ... d[N - 1].
You can perform AT MOST one move on the array: choose any two integers [L, R], and flip all the elements between (and including) the L-th and R-th bits. L and R represent the left-most and right-most index of the bits marking the boundaries of the segment which you have decided to flip.
What is the maximum number of '1'-bits (indicated by S) which you can obtain in the final bit-string?
'Flipping' a bit means, that a 0 is transformed to a 1 and a 1 is transformed to a 0 (0->1,1->0).
Input Format
An integer N
Next line contains the N bits, separated by spaces: d[0] d[1] ... d[N - 1]
@ajgupta
ajgupta / final_eclipse_ini
Created October 30, 2014 08:50
eclipse.ini file after adding path
-startup
plugins/org.eclipse.equinox.launcher_1.3.0.v20140415-2008.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.200.v20140603-1326
-product
org.eclipse.epp.package.standard.product
--launcher.defaultAction
openFile
--launcher.XXMaxPermSize
256M
@ajgupta
ajgupta / Path
Created October 30, 2014 08:48
Path to add in eclipse.ini file
-vm
C:\Program Files\Java\jdk1.7.0_71\bin
@ajgupta
ajgupta / initial_eclipse_ini
Last active August 29, 2015 14:08
Initial eclipse.ini file
-startup
plugins/org.eclipse.equinox.launcher_1.3.0.v20140415-2008.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.200.v20140603-1326
-product
org.eclipse.epp.package.standard.product
--launcher.defaultAction
openFile
--launcher.XXMaxPermSize
256M
@ajgupta
ajgupta / RemoveJava6
Created September 18, 2014 05:01
Remove java directory
sudo rm -rf /path/to/jre1.5
@ajgupta
ajgupta / RemoveJava5
Created September 18, 2014 04:56
Find Java directories
sudo updatedb
sudo locate -b '\pack200'
@ajgupta
ajgupta / RemoveJava5
Created September 18, 2014 04:52
Remove Java entries
for g in ControlPanel java java_vm javaws jcontrol jexec keytool mozilla-javaplugin.so orbd pack200 policytool rmid rmiregistry servertool tnameserv unpack200 appletviewer apt extcheck HtmlConverter idlj jar jarsigner javac javadoc javah javap jconsole jdb jhat jinfo jmap jps jrunscript jsadebugd jstack jstat jstatd native2ascii rmic schemagen serialver wsgen wsimport xjc xulrunner-1.9-javaplugin.so; do sudo update-alternatives --remove-all $g; done
@ajgupta
ajgupta / RemoveJava4
Created September 18, 2014 04:48
Remove manually installed JVM
sudo rm -rf /usr/lib/jvm/*
@ajgupta
ajgupta / RemoveJava3
Created September 18, 2014 04:44
Remove cache directory
sudo bash -c 'ls -d /home/*/.java' | xargs sudo rm -rf