r.dbCreate('mydb')
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
| // SPDX-License-Identifier: GPL-3.0 | |
| pragma solidity >=0.7.0 <0.9.0; | |
| contract MyContract { | |
| string value; | |
| function get() public view returns (string memory) { | |
| return value; | |
| } |
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
| export const Countries = [ | |
| { ru:"Афганистан",lt:"Afganistanas",tr:"Afganistan", en: 'Afghanistan', flag: '🇦🇫', code: 'AF', dialCode: '+93', mask: '999 999 9999' }, | |
| { ru:"Аландские острова",lt:"Alandų salos",tr:"Aland adaları", en: 'Åland Islands', flag: '🇦🇽', code: 'AX', dialCode: '+358', mask: '999 9999999' }, | |
| { ru:"Албания",lt:"Albanija",tr:"Arnavutluk", en: 'Albania',flag: '🇦🇱',code: 'AL', dialCode: '+355', mask: '999 999 9999' }, | |
| { ru:"Алжир",lt:"Alžyras",tr:"Cezayir", en: 'Algeria',flag: '🇩🇿',code: 'DZ', dialCode: '+213', mask: '9999 99 99 99' }, | |
| { ru:"американское Самоа",lt:"Amerikos Samoa",tr:"Amerikan Samoası", en: 'American Samoa',flag: '🇦🇸',code: 'AS', dialCode: '+1684', mask: '(999) 999-9999' }, | |
| { ru:"андорра",lt:"Andora",tr:"Andorra", en: 'Andorra',flag: '🇦🇩',code: 'AD', dialCode: '+376', mask: '999 999' }, | |
| { ru:"Ангола",lt:"Angoloje",tr:"Angora", en: 'Angola',flag: '🇦🇴',code: 'AO', dialCode: '+244', mask: '999 999 999' }, | |
| { ru:"Ангилья",lt:"Angilija",tr:"Anguilla", |
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 getHitProbability(R, C, G) { | |
| // Write your code here | |
| let empty = 0; | |
| let filled = 0; | |
| let tot = R*C | |
| for(let i = 0; i < R; i++){ | |
| for(let j = 0; j < C; j++){ | |
| G[i] && G[i][j] === 1 ? filled++ : empty++ | |
| } |
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
| const str = "Yeah_so_many_underscores here"; | |
| // const str = "A-B-C"; | |
| // const newStr = str.replace(/_/g, " "); | |
| const newStr = str.replace(/[_!@#$%^&*, -]/g, " "); | |
| const arr = newStr.split(' '); | |
| // remove first word | |
| let arr1 = arr.slice(0,1) | |
| let arr2 = arr.slice(1) |
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 tribonacci(n) { | |
| let seq = [1,1,1]; | |
| let index; | |
| for (let i = 3; i < n; i++) { | |
| seq.push(seq[seq.length - 1] + seq[seq.length - 2] + seq[seq.length - 3]) | |
| } | |
| console.log(seq) | |
| return seq.slice(0, n); | |
| } |
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 digPow(n, p){ | |
| const digits = n.toString().split('').map(Number); | |
| let sum = 0; | |
| digits.forEach(digit => { | |
| sum += Math.pow(digit , p); | |
| p++; | |
| }) | |
| return sum % n ? -1 : sum/n; |
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
| const countBits = n => n.toString(2).split('0').join('').length | |
| countBits(1234); |
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
| /* | |
| Prompt: | |
| We have defined a basic dropdown via the Dropdown and DropdownItem components below, with example usage | |
| in the ExampleNav component. The Dropdown and DropdownItem components have some problems, and also | |
| have room for improvements (doesn't everything?) A couple items TODO here (make sure to explain with comments!) | |
| 0. How are you today? 😊 | |
| I am great. This is an interesting exercise | |
| 1. Please fix any obvious issues and make you see with the dropdown. |
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
| let arr1 = [13, -3, -25, 20, -3, -16, -23, 18, 20, -7, 12, -5, -22, 15, -4, 7]; | |
| function maxSubArray (nums) { | |
| let maxC = nums[0]; | |
| let maxG = nums[0]; | |
| for (let i = 1; i < nums.length; i++) { | |
| maxC = Math.max(nums[i], maxC + nums[i]); | |
| maxG = maxC > maxG ? maxC : maxG; | |
| } |