When your password contains an asterisk.
Use the physical number keypad to the right of the display screen to enter an asterisk.
// Check if the figure can be placed at a specific row and column | |
const canPlaceFigure = (figure, field, startRow, startCol) => { | |
for (let i = 0; i < figure.length; i++) { | |
for (let j = 0; j < figure[0].length; j++) { | |
if (figure[i][j] === 1 && field[startRow + i][startCol + j] === 1) { | |
return false; // Conflict detected | |
} | |
} | |
} | |
return true; // Placement is possible |
<!DOCTYPE html> | |
<html> | |
<head> | |
</head> | |
<body class="main"> | |
<h1>Frontend Task</h1> | |
<div> | |
<div id='left-box'><button id='left' class='btn-box left-shift-button'><<</button></div> | |
<div id='division'> | |
<div class='box'>1</div> |
/** | |
* Definition for singly-linked list. | |
* class ListNode { | |
* val: number | |
* next: ListNode | null | |
* constructor(val?: number, next?: ListNode | null) { | |
* this.val = (val===undefined ? 0 : val) | |
* this.next = (next===undefined ? null : next) | |
* } | |
* } |
const maxProfit = prices => { | |
let left = 0; | |
let right = 1; | |
let maxProfit = 0; | |
while (right < prices.length) { | |
if (prices[left] < prices[right]) { | |
const profit = prices[right] - prices[left]; | |
maxProfit = Math.max(maxProfit, profit); | |
} |
class Store { | |
values = []; | |
indices = {}; | |
constructor() { | |
this.values = []; | |
this.indices = {}; | |
} | |
add(value) { |
const countSumPowerTwo = arr => { | |
let result = 0; | |
const hash = {}; | |
// Iterate each number in the array. | |
for (let i=0; i<arr.length; i++) { | |
const element = arr[i]; | |
const powerOfTwos = []; | |
// Increment the count for the occurrence of this element. |
function isAcronym(words: string[], s: string): boolean { | |
let result = true; | |
let offset = 0; | |
for (let i=0; i<words.length; i++) { | |
const word = words[i]; | |
const letter = word[0]; | |
if (s[offset++] !== letter) { | |
result = false; |
function isRectangleOverlap(rec1: number[], rec2: number[]): boolean { | |
const [ rec1_x1, rec1_y1, rec1_x2, rec1_y2 ] = rec1; | |
const [ rec2_x1, rec2_y1, rec2_x2, rec2_y2 ] = rec2; | |
const isOverlapX: boolean = rec1_x1 < rec2_x2 && rec2_x1 < rec1_x2; | |
const isOverlapY: boolean = rec1_y1 < rec2_y2 && rec2_y1 < rec1_y2; | |
return isOverlapX && isOverlapY; | |
}; |