This file contains hidden or 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
/** | |
* Created by yevgnen on 2016-11-23. | |
*/ | |
public final class PhoneNumber { | |
private final short areaCode; | |
private final short prefix; | |
private final short lineNumber; | |
private volatile int hashCode; | |
public PhoneNumber(int areaCode, int prefix, int lineNumber){ |
This file contains hidden or 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
function solution(str){ | |
var open = '({['; | |
var close = ')}]'; | |
var pair = {')': '(', '}': '{', ']':'['}; | |
var bracket = []; | |
for(var i=str.length-1; i>=0; i--){ | |
if(open.indexOf(str[i]) > -1){ | |
if(bracket[bracket.length-1] === str[i]){ | |
bracket.pop(); |
This file contains hidden or 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
function solution(arr){ | |
if(arr.length === 3){ | |
return arr[0] * arr[1] * arr[2]; | |
} | |
var positive_res = find_triplet_product(arr.slice()); | |
var negative_res = check_negative(arr.slice()); | |
return Math.max(positive_res, negative_res); |
This file contains hidden or 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.min = function() { | |
return Math.min.apply(null, this); | |
}; | |
function solution(nucleo, start, end) { | |
var result = []; | |
if(nucleo.length === 1){ | |
count = Math.min(start.length, end.length); | |
for(var i=0; i<count; i++){ | |
result.push(get_nucleo_number(nucleo[0])); |
This file contains hidden or 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
function erathos(start, end){ | |
var numbers = init_arr(end); | |
var res = []; | |
for(var i=2; i<numbers.length; i++){ | |
if(numbers[i]){ | |
continue; | |
} | |
res.push(i); | |
for(var j=i*i; j<end+1; j+=i){ | |
numbers[j] = true; |
This file contains hidden or 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
start, end = map(int, input().split()) | |
def erathos(start, end): | |
numbers = [False for _ in range(end+1)] | |
prime_numbers = [] | |
numbers[0] = True | |
numbers[1] = True | |
for num, prime in enumerate(numbers): | |
if prime: | |
continue |
This file contains hidden or 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
function solution(A){ | |
n = A.length; | |
if(n === 1) | |
return Math.abs(A[0]); | |
if(n === 2) | |
return Math.abs(A[0]-A[1]); | |
var total_array = arr_sum(A); | |
var min_abs = false; | |
var left = 0, right = 0; |
This file contains hidden or 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
function solution(A){ | |
if(A.length === 1) | |
return A[0]; | |
A = A.sort(); | |
var xor = 0; | |
for(var i=0; i<A.length; i++){ | |
console.log('xor' , xor^A[i], 'xor:',xor, A[i]); | |
xor = xor ^ A[i]; | |
} |
This file contains hidden or 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
String.prototype.stripWhiteSpace = function(){ | |
var res = []; | |
for(var i = 0; i < this.length; i++) { | |
var tempChar = this.charAt(i); | |
if( tempChar != ' ') { | |
res.push(tempChar); | |
} | |
} | |
return res.join(""); | |
} |
This file contains hidden or 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
cnt = int(input()) | |
aim_strings = [] | |
for _ in range(cnt): | |
aim_strings.append(input()) | |
def encrypt_even_odd(strings): | |
even_str = '' | |
odd_str = '' |