All Posts

Leetcode 1784: Check if Binary String Has at Most One Segment of Ones

Given a binary string s without leading zeros, return true if the string contains at most one contiguous block of 1s. Otherwise, return false.

Leetcode 1790: Check if One String Swap Can Make Strings Equal

You are given two strings, s1 and s2, of equal length. A string swap is an operation where you choose two indices in a string (not necessarily different) and swap the characters at these indices. Return true if it is possible to make both strings equal by performing at most one string swap on exactly one of the strings. Otherwise, return false.

Leetcode 1791: Find Center of Star Graph

You are given an undirected star graph consisting of n nodes labeled from 1 to n. A star graph is a type of graph where one central node is connected to all other nodes. In this problem, you are given a list of edges where each edge represents a connection between two nodes. Your task is to find the center of the star graph, which is the node that is connected to every other node.

Leetcode 1796: Second Largest Digit in a String

You are given an alphanumeric string ’s’, which consists of lowercase English letters and digits. Your task is to find the second largest numerical digit in ’s’. If there is no second largest digit, return -1.

Leetcode 1800: Maximum Ascending Subarray Sum

Given an array of positive integers ’nums’, return the maximum possible sum of an ascending subarray. A subarray is ascending if for each i, num[i] < num[i+1].

Leetcode 1805: Number of Different Integers in a String

You are given a string word consisting of digits and lowercase English letters. Replace every non-digit character with a space and count how many distinct integers are formed after the replacement.