Skip to content

Instantly share code, notes, and snippets.

View laddered's full-sized avatar
🤔

Erik Mark laddered

🤔
View GitHub Profile
javascript: (function() {let gold=$("div.title-subinfo>div:contains('Золото')").closest("tr").find("td:last-child").text();gold=gold.replace(" ",""),gold=gold.replace(",","."),gold=parseFloat(gold).toFixed(2),console.log(gold);let dollar=$("div.title-subinfo>div:contains('Доллар США')").closest("tr").find("td:nth-child(2n)").text();dollar=dollar.replace(" ",""),dollar=dollar.replace(",","."),dollar=parseFloat(dollar).toFixed(2),console.log(dollar),alert("Стоимость золота на сегодня "+(gold/dollar).toFixed(2)+" USD");})();
function solution(X, A) {
if (A.length === 1) {
if (A[0] === 1 && X === 1) return 0;
else return -1;
}
i = -1
sumOfArr = 0
sequenceSum = (X * (X+1)) / 2
arrOfFound = []
function solution(A) {
A.sort(function(a,b){return a-b})
count=0
for(i=0; i<A.length; i++){
if(A[i]===i+1){
count++
}else{
break
}
}
function solution(A) {
while(A.length>0){
findEl=A.shift()
indexEl=A.indexOf(findEl)
if(indexEl>=0){
A.splice(indexEl,1)
}else{
return findEl
}
}
function solution(A, K) {
if(A.length%K){
for(let i=0; i<K; i++){
lastNumber=A.pop()
A.unshift(lastNumber)
}
}
return A
}
function solution(N) {
line=N.toString(2)
arr=line.split('1')
if(arr[arr.length-1]!=''){
arr.pop()
}
arr.sort()
if(arr[arr.length-1]!=''){
return arr[arr.length - 1].length
}
function solution(A) {
A.sort((a, b) => a > b ? 1 : -1);
if(A[0]!==1){
return 1
}
for (let i=0; i<A.length-1; i++){
if((parseInt(A[i], 10)+1)!==A[i+1]){
return A[i]+1
}
}
function solution(A) {
let P=A.length-1, difArr=[]
for(let i=1; i<=P; i++){
let LSumm=0, RSumm=0;
for(let j=0; j<A.length; j++){
if(j<i){
LSumm+=A[j]
}
else{