Given a string s, return the number of unique palindromes of length three that are a subsequence of s. Note that even if there are multiple ways to obtain the same subsequence, it is still only counted once. A palindrome is a string that reads the same forwards and backwards. A subsequence of a string…
Author: Admin
Leet code problem 1927: – Sum Game
Alice and Bob take turns playing a game, with Alice starting first. You are given a string num of even length consisting of digits and ‘?’ characters. On each turn, a player will do the following if there is still at least one ‘?’ in num: The game ends when there are no more ‘?’…
Leet code problem 1926: – Nearest Exit from Entrance in Maze
You are given an m x n matrix maze (0-indexed) with empty cells (represented as ‘.’) and walls (represented as ‘+’). You are also given the entrance of the maze, where entrance = [entrancerow, entrancecol] denotes the row and column of the cell you are initially standing at. In one step, you can move one…
Leet code problem 1812: – Determine Color of a Chessboard Square
You are given coordinates, a string that represents the coordinates of a square of the chessboard. Below is a chessboard for your reference. Flow Diagram: – Solution: –
Leet code problem 1805: – Number of Different Integers in a String
You are given a string word that consists of digits and lowercase English letters. You will replace every non-digit character with a space. For example, “a123bc34d8ef34″ will become ” 123 34 8 34″. Notice that you are left with some integers that are separated by at least one space: “123”, “34”, “8”, and “34”. Return…
Leet code problem 1800: – Maximum Ascending Subarray Sum
Given an array of positive integers nums, return the maximum possible sum of an ascending subarray in nums. A subarray is defined as a contiguous sequence of numbers in an array. A subarray [numsl, numsl+1, …, numsr-1, numsr] is ascending if for all i where l <= i < r, numsi < numsi+1. Note that…
Leet code 1796: – Second Largest Digit in a String
Given an alphanumeric string s, return the second largest numerical digit that appears in s, or -1 if it does not exist. An alphanumeric string is a string consisting of lowercase English letters and digits. Example 1: Input: s = “dfa12321afd”Output: 2Explanation: The digits that appear in s are [1, 2, 3]. The second largest…
How to handle SSL certificate in Edge browser for Selenium Web-Driver?
In many cases we can face the error related to SSL certificate as mentioned below :- So, this error in Edge browser can be handled using EdgeOptions class provided by Selenium Web driver. The sample code block is mentioned below:- In the above code block we are accepting the Insecure certificate by passing Boolean value…
Leet code 1791: – Find Center of Star Graph
There is an undirected star graph consisting of n nodes labeled from 1 to n. A star graph is a graph where there is one center node and exactly n – 1 edges that connect the center node with every other node. You are given a 2D integer array edges where each edges[i] = [ui,…
Leet code 1901: – Find a Peak Element II
A peak element in a 2D grid is an element that is strictly greater than all of its adjacent neighbors to the left, right, top, and bottom. Given a 0-indexed m x n matrix mat where no two adjacent cells are equal, find any peak element mat[i][j] and return the length 2 array [i,j]. You…