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
no = ARGV[0].to_i | |
copy_no = no | |
check_digit = 0 | |
for i in 2..13 | |
if i%2 !=0 | |
check_digit = check_digit + (copy_no%10) * 1 | |
else | |
check_digit = check_digit + (copy_no%10) * 3 | |
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
lines = IO.readlines("input.txt") | |
coordinates = lines[0] | |
max_x,max_y = lines[0].split(" ") | |
i = 1 | |
def final_coordinates(x,y,d,steps) | |
x = x.to_i |
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
require 'open-uri' | |
require 'json' | |
module Github | |
COMMIT_TYPE_SCORE_MAPPING = { | |
PushEvent: 5, | |
PullRequestReviewCommentEvent: 4, | |
WatchEvent: 3, | |
CreateEvent: 2 |
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
require 'open-uri' | |
require 'json' | |
class Temprature | |
DROPBOX_FILE_URL = 'https://www.dropbox.com/s/zih6f1psx82ehe1/miami-temperature.txt?dl=1' | |
def initialize | |
get_data_from_dropbox_file | |
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
class PriceCalculator | |
attr_reader :item_quantities, :item_names | |
ITEM_UNIT_PRICES = { | |
milk: 3.97, | |
bread: 2.17, | |
banana: 0.99, | |
apple: 0.89 | |
} |
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 HelloWorld{ | |
public static void main(String []args){ | |
int p = 0; | |
int q = 1; | |
int n = 13; | |
int tmp = 0; | |
while(n > 0){ | |
System.out.println(q); | |
tmp = q; |
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 HelloWorld{ | |
public static void main(String []args){ | |
int arr[] = new int[13]; | |
fab(13, arr); | |
} | |
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
// 0 means there is no substring | |
import java.util.Scanner; | |
public class HelloWorld{ | |
public static void main(String []args){ | |
String s1 = "dyittvbiaxyavvvyia"; | |
String s2 = "itya"; |
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 Solution | |
attr_accessor :string1, :string2, :string3 | |
def shortest_length | |
char_count_arr = create_char_count_array | |
return 0 if string2.length > string1.length |
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 Str { | |
public static void main (String[] args){ | |
String p1 = " abhinav is a good"; | |
int i=0; | |
int j=0; | |
int count = 0; | |
while(i < p1.length()){ | |
if(p1.charAt(i) == '\t' || p1.charAt(i) == ' '){ | |
i++; |
OlderNewer