Instantly share code, notes, and snippets.

🎯
Focusing

# Ganesh Swamypillaigansai

🎯
Focusing
• Sort options
Created Sep 21, 2019
Java Hello World
View HelloWorld.java
 package com.sample.code.java; public class HelloWorld { public static void main(String[] args) { System.out.println("Hello World"); } }
Last active Aug 24, 2019
check for string rotation in java
View IsRotation.java
 public class IsRotation { public static void main(String[] args) { String a = "ABCD"; String b = "DABC"; System.out.println(isRotation(a,b));
Created Jan 19, 2019
View JavaOnJupyterNotebook.txt
 Please follow below steps to use Java on Jupyter Notebook, to experiment Java code on browser and share snippets with others for trying out. Please note that this is for windows environment. 1. Install Anaconda for Windows from https://www.anaconda.com/download/ 2. After installation of Anaconda, open Anaconda Navigator and install Jupyter Notebook 3. Download java kernel from https://github.com/SpencerPark/IJava/releases/download/v1.2.0/ijava-1.2.0.zip 4. Extract ijava-1.2.0.zip file
Created Jul 24, 2016
Created Nov 12, 2015
Reading a text file in Java
 import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; /** * Created by gansai on 12/11/15. * Referred to http://stackoverflow.com/a/4716623 */ public class ReadFile {
Created Oct 11, 2015
Given an array, find a pair which sums up to a number (Sorted array solution)
View FindPairSum_Sorted.java
 import java.util.*; /** * Created by gansai on 11/10/15. */ public class FindPairSum_Sorted { public static void main(String args[]) { Integer array[] = new Integer[] { 1, 43, 2, 55, 21, 87, 9 };
Last active Oct 11, 2015
Given an array and a sum x, find a pair in array which sums up to x. (Brute-force)
View FindPairSum_Brute.java
 /** * Created by gansai on 11/10/15. */ public class FindPairSum_Brute { public static void main(String args[]) { int array[] = new int[] { 1, 43, 2, 55, 21, 87, 9 }; int sum = 76; boolean foundPair = false;
Created Oct 5, 2015
Ruby code to illustrate basic programming
View first.rb
 #This is my first Ruby code print "Hi Everyone. How are you?" puts "Enter a value" num = gets.to_i puts "Enter another value" num_2 = gets.to_i puts num.to_s + " + " + num_2.to_s + " = " + (num + num_2).to_s
Last active Oct 4, 2015
Illustration on how to retrieve home timeline from twitter using Java code
View TweetMain.java