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
// Kiểm tra xem một DOM node có vượt quá kích thước của container hay không? | |
// Nếu có thì sẽ thêm scrollbar cho nó, ngược lại thì không. | |
// Kiểm tra xem 1 element có vượt quá chiều rộng của container không | |
const isOverflowedX = elm => elm.scrollWidth > elm.clientWidth; | |
// Kiểm tra xem 1 element có vượt quá chiều cao của container không | |
const isOverflowedY = elm => elm.scrollHeight > elm.clientHeight; | |
// Nếu 1 element có chiều rộng vượt quá container, |
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 a = () => console.log('a'); | |
const b = () => console.log('b'); | |
const c = () => console.log('c'); | |
const d = () => { | |
console.log('d'); | |
setTimeout(a, 0); | |
b(); | |
c(); | |
} | |
d(); |
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
class CQueue { | |
constructor(capacity) { | |
this.data = []; | |
this.capacity = capacity; | |
this.size = 0; | |
this.front = 0; | |
this.rear = 0; | |
} | |
isFull() { |
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
class AQueue { | |
constructor(capacity) { | |
this.data = []; | |
this.capacity = capacity; | |
this.size = 0; | |
} | |
isFull() { | |
return this.size === this.capacity; | |
} |
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 Stack(){ | |
var stack = {}; | |
var stackSize = 0; | |
return { | |
push: function(item){ | |
stack[stackSize] = item; | |
stackSize++; | |
}, | |
pop: function(){ |
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
class OStack { | |
constructor(capability) { | |
this.data = {}; | |
this.size = 0; | |
this.capability = capability; | |
} | |
isEmpty() { | |
return this.size === 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
class MStack { | |
constructor(capability) { | |
this.data = new Map(); | |
this.capability = capability; | |
} | |
isEmpty() { | |
return this.data.size === 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
class AStack { | |
constructor(capability) { | |
this.data = []; | |
this.capability = capability; | |
} | |
isEmpty() { | |
return this.data.length === 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
#include <iostream> | |
using namespace std; | |
long long sumAll(long long a, long long b) { | |
long long n; | |
if (b > a) n = b - a + 1; | |
else n = a - b + 1; | |
return n * (a + b) / 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
#include <iostream> | |
using namespace std; | |
const int MAX_N = 1000001; | |
char input[MAX_N], output[MAX_N]; | |
// Node | |
struct Node { | |
char data; | |
Node *next; |