|
51 | 51 | - [Math & Stats](#math--stats)
|
52 | 52 | - [Integer Division Without Using \* or /](#integer-division-without-using--or-)
|
53 | 53 | - [JavaScript Fundamentals](#javascript-fundamentals)
|
| 54 | +- [increment letters by 3](#increment-letters-by-3) |
54 | 55 | - [How to convert -ve to +ve number?](#how-to-convert--ve-to-ve-number)
|
55 | 56 | - [Array slice](#array-slice)
|
56 | 57 | - [Math.floor](#mathfloor)
|
@@ -596,11 +597,25 @@ node .\src\math-and-stats\integer-division.js
|
596 | 597 |
|
597 | 598 | ## JavaScript Fundamentals
|
598 | 599 |
|
| 600 | +## increment letters by 3 |
| 601 | + |
| 602 | +Letters asci code starts from `96` to `122`. |
| 603 | + |
| 604 | +- `charCodeAt()` gives the ascii code. |
| 605 | +- `String.fromCharCode(code)` converts code to string. |
| 606 | + |
| 607 | +```js |
| 608 | +const letter = 'A'; |
| 609 | +const newKey = (letter.charCodeAt() + 3) % 122; |
| 610 | +const result = String.fromCharCode(newKey); |
| 611 | +console.log(result); //"D" |
| 612 | +``` |
| 613 | + |
599 | 614 | ### How to convert -ve to +ve number?
|
600 | 615 |
|
601 | 616 | ```js
|
602 |
| -Math.abs(-4) //4 |
603 |
| -Math.abs(2) //2 |
| 617 | +Math.abs(-4); //4 |
| 618 | +Math.abs(2); //2 |
604 | 619 | ```
|
605 | 620 |
|
606 | 621 | ### Array slice
|
@@ -672,11 +687,9 @@ Trade off or invest some memory to improve run time complexity. Suppose use Has-
|
672 | 687 |
|
673 | 688 | #### Depth First Search Question
|
674 | 689 |
|
675 |
| - |
676 | 690 | **Category**: Graphs
|
677 | 691 | **Difficulty**: Easy
|
678 | 692 |
|
679 |
| - |
680 | 693 | <p class="codepen" data-height="265" data-theme-id="dark" data-default-tab="js,result" data-user="roopkt" data-slug-hash="MWpxezz" style="height: 265px; box-sizing: border-box; display: flex; align-items: center; justify-content: center; border: 2px solid; margin: 1em 0; padding: 1em;" data-pen-title="Graph: DFS Question (easy)">
|
681 | 694 | <span>See the Pen <a href="https://codepen.io/roopkt/pen/MWpxezz">
|
682 | 695 | Graph: DFS Question (easy)</a> by Rupesh Tiwari (<a href="https://codepen.io/roopkt">@roopkt</a>)
|
|
0 commit comments