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
interface BasePerson { | |
firstName: string; | |
lastName: string; | |
password: string; | |
apiToken: string; | |
} | |
interface ShowProfile { | |
showProfile(): string; | |
} |
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
/** | |
Cartesian product | |
for example for input: [['x', 'y'], [1, 2 ]] | |
we will have output: ['x1', 'x2', 'y1', 'y2'] | |
for example for input: [['x', 'y'], [1, 2, 3]] | |
we will have output: ['x1', 'x2', 'x3', 'y1', 'y2', 'y3'] | |
1 1 -> 1 | |
1 2 -> 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
var maxSubArray = function(nums) { | |
if (nums.length === 1) return nums[0]; | |
const reserveResult = Math.max(...nums); | |
for (let i = 0; i < nums.length; i++) { | |
if (i && (nums[i] > 0 && nums[i - 1] > 0) || (nums[i - 1] + nums[i] > 0 && nums[i] < nums[i - 1] + nums[i])) { | |
nums[i] = nums[i - 1] + nums[i]; | |
} else if (nums[i] < 0) { | |
nums[i] = 0; | |
} | |
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
function maxSubArray(nums) { | |
// time - O(n^3), memory - O(1) | |
let max = nums[0]; | |
for (let i = 0; i <= nums.length; i++) { | |
for(let j = 0; j <= i; j++) { | |
if (i === j) continue; | |
const newMax = nums.slice(j, i).reduce((a, b) => a += b, 0); | |
max = max > newMax ? max : newMax; | |
} | |
} |
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
function estimatePi(n) { | |
let numPointCircle = 0; | |
let numPointTotal = 0; | |
for (let i = 0; i < n; i++) { | |
const x = Math.round(Math.random()) | |
const y = Math.round(Math.random()) | |
let distance = x ** 2 + y ** 2; | |
if (distance <= 1) { |
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
version: 0.2 | |
phases: | |
install: | |
runtime-versions: | |
docker: 18 | |
pre_build: | |
commands: | |
- echo Starting aws code-build phase... | |
- echo Logging in to Amazon ECR... |
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
const path = require('path'); | |
module.exports = async ({ config, mode }) => { | |
config.module.rules.push({ | |
test: /\.scss$/, | |
use: ['style-loader', 'css-loader', { | |
loader: 'postcss-loader', options: { | |
ident: 'postcss', | |
plugins: (loader) => [ |
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
const path = require('path'); | |
module.exports = async ({ config, modpose }) => { | |
config.module.rules.push({ | |
test: /\.scss$/, | |
use: ['style-loader', 'css-loader', 'postcss-loader'], | |
include: path.resolve(__dirname, '../'), | |
}); |
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
const fs = require('fs') | |
const fsPromises = require('fs').promises | |
const path = require('path') | |
const promisifyStat = (path) => new Promise((resolve, reject) => { | |
fs.stat(path, (err, stat) => { | |
if (err) reject(err) | |
resolve(stat) | |
}) | |
}) |
NewerOlder