arc-arnob / daily-coding-practice Goto Github PK
View Code? Open in Web Editor NEWDaily Coding Practice. Wanna learn together? Just fork this and let the PRs flow! We'll review it together!
Daily Coding Practice. Wanna learn together? Just fork this and let the PRs flow! We'll review it together!
const printPermutation = (originalString, permutedStrings) => {
if(originalString.length === 0){
console.log(permutedStrings);
return;
}
for(i in originalString){
const firstChar = originalString[i];
const remainingString =originalString.substring(0, i) + originalString.substring(i + 1);
printPermutation(remainingString, permutedStrings + firstChar);
}
}
printPermutation("abc", "");
Debounce is a common technique used in Web Application, in most cases using lodash solution would be a good choice.
could you implement your own version of basic debounce()?
In case you forgot, debounce(func, delay) will returned a debounced function, which delays the invoke.
Here is an example.
Before debouncing we have a series of calling like
─A─B─C─ ─D─ ─ ─ ─ ─ ─E─ ─F─G
After debouncing at wait time of 3 dashes
─ ─ ─ ─ ─ ─ ─ ─ D ─ ─ ─ ─ ─ ─ ─ ─ ─ G
notes
please follow above spec. the behavior might not be exactly the same as lodash.debounce()
because window.setTimeout and window.clearTimeout are not accurate in browser environment, they are replaced to other implementation when judging your code. They still have the same interface, and internally keep track of the timing for testing purpose.
Type 'TreeNode | undefined' is not assignable to type 'TreeNode'.
Type 'undefined' is not assignable to type 'TreeNode'.ts(2322)
on line 95, 165, 181
SyntaxError: Cannot use import statement outside a module
getAllSubsequence(str) {
/**
* Expectation:
* f(abc): '', a, b, c, ab, bc, ca, abc
* Here at each recursion level each element
* can decide to join the subset or not
*/
console.log("Started: ", str);
// Base Case
if(str.length === 0) {
const baseCaseResult = [];
baseCaseResult.push[""];
return baseCaseResult;
}
// get the first element in consideration
const ch = str[0];
// get the reamining string
const remainingString = str.substring(1);
console.log("Remaining subsr: ", remainingString);
const recursion_result = this.getAllSubsequence(remainingString);
const result = [];
for(let i in recursion_result){
console.log('I is: ', i);
result.push(i);
}
for(let i in recursion_result){
console.log('I is: ', i);
result.push( ch + i);
}
console.log("Returning: ", result);
return result;
}
}
const getSS = new Solution();
console.log(getSS.getAllSubsequence('abc'));```
What is {} + {} in JavaScript?
function function2() {
// Normal Array Methods cant be called on arguments:
let argsArray = Array.prototype.slice.call(arguments);
console.log(argsArray);
}
function2(1, 2, 4); // Output: [1, 2, 4]
console.log(JSON.stringify([1, 2, null, 3])) // "[1,2,null,3]"
console.log(JSON.stringify([1, 2, undefined, 3])) // "[1,2,null,3]"
console.log(null === undefined) // false
console.log(null == undefined) // true
console.log(null == 0)// false
console.log(null < 0)//false ???
console.log(null > 0) // false
console.log(null <= 0) // true???
console.log(null >= 0)// true
console.log(undefined == 0) // false
console.log(undefined < 0) // false
console.log(undefined > 0) // false
console.log(undefined <= 0) // false
console.log(undefined >= 0) // false
@mayank-m-sharma can you find the bug in /javascript/integer-to-roman
I think we need to learn what this question is mathematically then we should proceed.
Need some explanation over this.
in #37 help me complete getInput()
function log(a, b, c, d) {
console.log(a, b, c, d);
arguments[0] = 'bfe';
arguments[3] = 'dev';
console.log(a, b, c, d);
}
log(1, 2, 3)
const memoTable = Array(n).fill(Array(n).fill(-1));
memoTable[n-1][n-1] = 16;
log memoTable
daily-coding-practice/leet_code_questions/group-anagrams-16-01-2023-22:55:04.js
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.