Skip to content

Instantly share code, notes, and snippets.

View inspector-ambitious's full-sized avatar

inspector-ambitious

View GitHub Profile

Given a string s, find the length of the longest substring without repeating characters.

Example 1:

Input: s = "abcabcbb"
Output: 3
Explanation: The answer is "abc", with the length of 3.

Exercise 1

Write a method that compute the sum of all the elements of an array of integers.

Example

input: [1, 2, 2, 3, 3, 4, 5, 6, 5, 7, 7, 7, 8, 8, 1] output: 69

Exercise 2

Write a method to reverse a string.

Exercise 1

Write a function that compute the sum of all the elements of an array of integers.

Example

input: [1, 2, 2, 3, 3, 4, 5, 6, 5, 7, 7, 7, 8, 8, 1] output: 69

Exercise 2

Exercise 1

Write a method that compute the sum of all the elements of an array of integers.

Example

input: [1, 2, 2, 3, 3, 4, 5, 6, 5, 7, 7, 7, 8, 8, 1] output: 69

Exercise 2

Write a method to reverse a string.

Exercise 1

Write a method that compute the sum of all the elements of an array of integers.

Example

input: [1, 2, 2, 3, 3, 4, 5, 6, 5, 7, 7, 7, 8, 8, 1] output: 69

Template

public static class SumNumbers

Find the difference

You are given two strings s and t.

String t is generated by random shuffling string s and then add one more letter at a random position.

Return the letter that was added to t.

Example 1:

Description

Given two strings s and t, return true if t is an anagram of s, and false otherwise.

An Anagram is a word or phrase formed by rearranging the letters of a different word or phrase, typically using all the original letters exactly once.

Example 1

// Step 1: Deep copy a jagged array with numbers or other arrays in a new array
const originalArray = [2, 4, 10, [12, 4, [100, 99], 4], [3, 2, 99], 0];
const deepCopyArray = (array) => {
};
console.log("## deepCopyArray");
console.log(deepCopyArray(originalArray));
// Step 2: Render jagged array in document body using semantic HTML
// Step 1: Create a function that will return the number of words in a text
const countWords = (text) => {
}
console.log(countWords("")); // 0
console.log(countWords(" ")); // 0
console.log(countWords("JavaScript !!! ")); // 1
console.log(countWords(" JavaScript")); // 1
console.log(countWords(" JavaScript is cool ")); // 3
// Step 1: Create a function that will return the number of words in a text
const countWords = (text) => {
}
console.log(countWords(""));
console.log(countWords(" "));
console.log(countWords("JavaScript!!! "));
console.log(countWords(" JavaScript"));
console.log(countWords(" JavaScript is cool "));