This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void main(String[] args) { | |
String n1 = "99"; | |
int n1size = n1.length(); | |
String n2 = "12"; | |
int n2size = n2.length(); | |
if (n2.length() > n1.length()) { | |
StringBuilder s = new StringBuilder(""); | |
for (int i = 0; i < n2size - n1size; i++) { | |
s.append("0"); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class NumberToWords{ | |
/** | |
* @param args | |
*/ | |
public static void main(String[] args) { | |
String noforWords = "15963"; | |
StringBuilder noinWords = new StringBuilder(); | |
//Integer val = Integer.parseInt(noforWords); | |
int curr = Integer.parseInt(noforWords); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
delete from cellulars1 where cid not in (select c.cid from cellulars1 c group by c.number); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.concurrency; | |
import java.util.concurrent.ConcurrentLinkedQueue; | |
public class ITCExist { | |
private static ConcurrentLinkedQueue<Integer> clQ = new ConcurrentLinkedQueue<>(); | |
static class Producer implements Runnable { | |
@Override |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Player | |
@health = 20 | |
def play_turn(warrior) | |
if warrior.feel.empty? then | |
if warrior.health<@health then | |
@health = warrior.health | |
warrior.walk! | |
else | |
@health = warrior.health | |
warrior.rest! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://sanctum.geek.nz/arabesque/actually-using-ed/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Array . prototype | |
Array.prototype.every = function(f){ | |
//isevery = false; // intially set to false | |
for(let i=0;i<this.length;i++) | |
if(!f(this[i])) return false; // onfailing it returns false | |
return true; | |
} | |
Array.prototype.some = function(f){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-module(pat_assignment). | |
-export([xOr1/2,xOr2/2,xOr3/2,xOr5/2,maxThree/3,test/0]). | |
xOr1(true,false)->true; | |
xOr1(false,true)->true; | |
xOr1(X,Y)->false. | |
xOr2(true,false)->true; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46> XOr=fun(true,X)->not(X); | |
(false,X)->X end. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-module(recursion_1_3_1). | |
-export([fib/1,dim/2]). | |
%fibonnaci | |
%0,1,2,3,4,5... | |
%0,1,1,2,3,5,... | |
fib(0)->io:fwrite([0," "]),0; | |
fib(1)->io:fwrite([1," "]),1; | |
fib(N) when N>1->K=fib(N-1)+fib(N-2),io:fwrite([K," "]),K. |
OlderNewer