Given `head`

, the head of a linked list, determine if the linked list has a cycle in it.

There is a cycle in a linked list if there is some node in the list that can be reached again by continuously following the `next`

pointer. Internally, `pos`

is used to denote the index of the node that tail's `next`

pointer is connected to. **Note that ****pos**** is not passed as a parameter**.

Return `true`

* if there is a cycle in the linked list*. Otherwise, return `false`

.

**Example 1:**

**Input:** head = [3,2,0,-4], pos = 1

**Output:** true

**Explanation:** There is a cycle…

Given a string `s`

, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.

**Example 1:**

**Input:** s = "A man, a plan, a canal: Panama"

**Output:** true

**Explanation:** "amanaplanacanalpanama" is a palindrome.

**Example 2:**

**Input:** s = "race a car"

**Output:** false

**Explanation:** "raceacar" is not a palindrome.

If I don’t know something I google it and usually, Wikipedia gives great answers. So here is a quick answer

Based on this solution…

You are given an array `prices`

where `prices[i]`

is the price of a given stock on the `ith`

day.

You want to maximize your profit by choosing a **single day** to buy one stock and choosing a **different day in the future** to sell that stock.

Return *the maximum profit you can achieve from this transaction*. If you cannot achieve any profit, return `0`

.

**Example 1:**

**Input:** prices = [7,1,5,3,6,4]

**Output:** 5

**Explanation:** Buy on day 2 (price = 1) and sell on day 5 (price = 6), profit = 6-1 = 5. …

Given an integer `rowIndex`

, return the `rowIndexth`

(**0-indexed**) row of the **Pascal's triangle**.

In **Pascal’s triangle**, each number is the sum of the two numbers directly above it as shown:

**Example 1:**

**Input:** rowIndex = 3

**Output:** [1,3,3,1]

**Example 2:**

**Input:** rowIndex = 0

**Output:** [1]

**Example 3:**

**Input:** rowIndex = 1

**Output:** [1,1]

Last week, I solved Pascal’s Triangle challenge, and the next one on the list was Pascal’s Triangle II. Considering that I already had a solution to the first challenge, I thought that it would be easy.

Just as a refresher, in the Pascal’s Triangle challenge, we…

Given an integer `numRows`

, return the first numRows of **Pascal's triangle**.

In **Pascal’s triangle**, each number is the sum of the two numbers directly above it as shown:

**Example 1:**

**Input:** numRows = 5

**Output:** [[1],[1,1],[1,2,1],[1,3,3,1],[1,4,6,4,1]]

**Example 2:**

**Input:** numRows = 1

**Output:** [[1]]

Even though a brief explanation of Pascal’s triangle is provided by leetcode

In

Pascal’s triangle, each number is the sum of the two numbers directly above it

I still prefer to google new terms for me, and as one of the top sources, I get Wikipedia to help me. …

**Question:** *Given a **non-empty** array of integers **nums**, every element appears twice except for one. Find that single one.*

You must implement a solution with a linear runtime complexity and use only constant extra space.

**Example 1:**

**Input:** nums = [2,2,1]

**Output:** 1

**Example 2:**

**Input:** nums = [4,1,2,1,2]

**Output:** 4

**Example 3:**

**Input:** nums = [1]

**Output:** 1

It’s important to understand a task, so we need to understand what linear runtime complexity is.

Let’s look at the time complexity definition first.

In computer science, the

time complexityis the computational complexity that describes the amount of computer time…

Given an integer array `nums`

where the elements are sorted in **ascending order**, convert *it to a **height-balanced** binary search tree*.

A **height-balanced** binary tree is a binary tree in which the depth of the two subtrees of every node never differs by more than one.

**Example 1:**

**Input:** nums = [-10,-3,0,5,9]

**Output:** [0,-3,9,-10,null,5]

**Explanation:** [0,-10,5,null,-3,null,9] is also accepted:

Given a binary tree, determine if it is height-balanced.

For this problem, a height-balanced binary tree is defined as:

a binary tree in which the left and right subtrees ofeverynode differ in height by no more than 1.

**Example 1:**

**Input:** root = [3,9,20,null,null,15,7]

**Output:** true

**Example 2:**

Given the `root`

of a binary tree and an integer `targetSum`

, return `true`

if the tree has a **root-to-leaf** path such that adding up all the values along the path equals `targetSum`

.

A **leaf** is a node with no children.

**Example 1:**

**Input:** root = [5,4,8,11,null,13,4,7,2,null,null,null,1], targetSum = 22

**Output:** true

**Example 2:**

Today I’ll cover 2 questions because they look pretty similar to me even though looking for opposite results. But the solution will have something in common.

Given the `root`

of a binary tree, return *its maximum depth*.

A binary tree’s **maximum depth** is the number of nodes along the longest path from the root node down to the farthest leaf node.

**Example 1:**

**Input:** root = [3,9,20,null,null,15,7]

**Output:** 3

I found using recursive functions with binary trees is really helpful and allows you to cover all branches. This question actually has a one-line solution, but let’s break it down.

We…