xxxxxxxxxx
function slowestKey(keyTimes) {
// Write your code here
const makeChar = num => String.fromCharCode(num + 97)
const map = []
for(let i = 0; i < keyTimes.length; i++){
if(keyTimes[i - 1]){
map.push([keyTimes[i][0], keyTimes[i][1] - keyTimes[i - 1] [1]])
}
else{
map.push([keyTimes[i][0], keyTimes[i][1]])
}
map.sort((first, second) => second[1] - first[1])
return makeChar(map[0][0])}
xxxxxxxxxx
>>> import js2py
>>> f = js2py.eval_js('function f(x) {return x + x}')
>>> f(2)
4
>>> f()
nan
>>> f(f)
function f(x) { [python code] }function f(x) { [python code] }
xxxxxxxxxx
const FS = require("fs");
var Thu_muc_Media = 'Media';
var Thu_muc_Du_lieu = 'Du_lieu';
var Thu_muc_HTML = Thu_muc_Du_lieu+"\\HTML";
var Thu_muc_Nhan_vien = Thu_muc_Du_lieu+"\\Nhan_vien/";
var Thu_muc_Quan_ly = Thu_muc_Du_lieu+"\\Quan_ly_Chi_nhanh";
xxxxxxxxxx
const MongoClient = require('mongodb').MongoClient;
const mongo_username = process.env.MONGO_USERNAME
const mongo_password = process.env.MONGO_PASSWORD
const uri = `mongodb+srv://${mongo_username}:${mongo_password}@cluster0-zrtwi.gcp.mongodb.net/crmdb?retryWrites=true&w=majority`;
const client = new MongoClient(uri, { useNewUrlParser: true });
xxxxxxxxxx
function jsfuckdecode(text) {
var jsFuckText = text;
//console.log(jsFuckText);
var start = jsFuckText.indexOf("()");
var len = jsFuckText.length;
try {
var result = '';
if (jsFuckText.length > 3 && jsFuckText.slice(len - 3) == ')()') {
var txt = jsFuckText.substring(0, len - 2);
result = (/\n(.+)/.exec(eval(txt))[1]);
} else if (jsFuckText.substring(0, 2) == '[]' && start >= 0) {
var txt = jsFuckText.substring(start + 2);
result = document.getElementById("plaint_jsfuck").value = (eval(txt));
} else {
result = document.getElementById("plaint_jsfuck").value = (eval(jsFuckText));
}
return result;
} catch (e) {
return "error input";
}
xxxxxxxxxx
function coppie(a,b){
var c=[];
for(var i=0;i<a.length;i++){
for(var j=0;j<b.length;j++){
if (a[i]==b[j]){
c.push(a[i]);
}
}
}
return c;
}
xxxxxxxxxx
n = 0
while n <= 0:
n = int(input("Enter the number of lines: "))
for i in range(1, n+1):
print('*' * i)
xxxxxxxxxx
n = 0
while n <= 0:
n = int(input("Enter the number of lines: "))
for i in range(1, n+1):
for j in range(1, i+1):
print('*', end='')
print()