Skip to content

Instantly share code, notes, and snippets.

View bragboy's full-sized avatar
🧘
Inner peace

Bragadeesh bragboy

🧘
Inner peace
View GitHub Profile
#!/usr/local/bin/perl
use strict;
use warnings;
print "Enter file name :: ";
my $infile = <STDIN>;
open(INP,"<$infile") or die "can not open file for reading";
def is_prime(n)
return false if n <= 1
2.upto(Math.sqrt(n).to_i) do |x|
return false if n%x == 0
end
true
end
Math.sqrt(600851475143).to_i.downto(2) do |n|
if is_prime(n) && 600851475143%n ==0
puts "Maximum prime factor for this number is #{n}"
break
end
package browserstack;
public class SeriesCompute {
/**
* My program assumes you always pass valid alphabets.
* For Non alphabet strings, program may behave wierd as no error handle is done for them
* @param args
*/
public static void main(String[] args) {
SeriesCompute computer = new SeriesCompute();
require 'anemone'
puts "Enter the value of N"
n = gets.chomp.to_i
patterns = []
1.upto(n) {|i| patterns << /chttp_tt_#{i}$/ }
cast = movies = {}
puts "Please wait crawling in progress"
Anemone.crawl('http://www.imdb.com/chart/top', :depth_limit=>1) do |anemone|
import java.io.*;
import java.util.*;
public class NovelFinder {
public static void main(String[] args) throws Exception {
File inputFile = new File("novel.in");
Scanner scanner = new Scanner(inputFile);
BufferedWriter out = new BufferedWriter(new FileWriter("novel.out"));
NovelFinder finder = new NovelFinder();
while (scanner.hasNextLine())
ShareStatusTask statusTask = new ShareStatusTask();
statusTask.Status = string.Format("Playing with my phone");
statusTask.Show();
package dsa.btree;
import java.awt.Dimension;
import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Rectangle;
import java.util.HashMap;
import javax.swing.JPanel;
package dsa.btree;
/**
* A class representing one node of the tree.
*/
public class Node {
private String content = null;
private Node left = null;
private Node right = null;
package dsa.btree;
import javax.swing.JFrame;
public class PreOrderInOrderReconstructor {
public static void main(String[] args) {
PreOrderInOrderReconstructor pir = new PreOrderInOrderReconstructor();
String[] preOrderSequence = { "A", "B", "D", "E", "C", "F", "G", "H", "I" };
String[] inOrderSequence = { "D", "B", "E", "A", "F", "C", "H", "G", "I" };
Node root = pir.reConstruct(preOrderSequence, 0,