Given an integer array nums of length n, you want to create an array ans of length 2n where ans[i] == nums[i] and ans[i + n] == nums[i] for 0 <= i < n (0-indexed). Specifically, ans is the concatenation of two nums arrays. Return the array ans. Example 1: Input: nums = [1,2,1]Output: [1,2,1,1,2,1]Explanation:…
Month: December 2022
Leet code problem 1930: – Unique Length-3 Palindromic Subsequences
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…
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,…