Articles on Trending Technologies

Technical articles with clear explanations and examples

Find the Kth Smallest Sum of a Matrix With Sorted Rows in C++

Arnab Chakraborty
Arnab Chakraborty
Updated on 11-Mar-2026 363 Views

Suppose we have one m * n matrix called mat, and an integer k, mat has its rows sorted in nondecreasing order. We can choose exactly one element from each row to form an array. We have to find the Kth smallest array sum among all possible arrays.So, if the input is like mat = [[1, 3, 11], [2, 4, 6]]1311246and k = 5, then the output will be 7, as when we choose one element from each row the first k smallest sums are [1, 2], [1, 4], [3, 2], [3, 4], [1, 6]. here the 5th sum is ...

Read More

Sliding Window Maximum in C++

Arnab Chakraborty
Arnab Chakraborty
Updated on 11-Mar-2026 880 Views

Suppose we have an array called nums, there is a sliding window of size k which is moving from the left of the array to the right. We can only see the k numbers in the window. Each time the sliding window moves to the right side by one position. We have to find the max sliding window. So if the input is like −[1, 3, -1, -3, 5, 3, 6, 8] and k is 3, then the window will be like −Window PositionMax13-1-35368313-1-35368313-1-35368313-1-35368513-1-35368613-1-353688To solve this, we will follow these steps −Define an array ansDefine one double ended queue dqif ...

Read More

Distinct Subsequences in C++ Programming

Arnab Chakraborty
Arnab Chakraborty
Updated on 11-Mar-2026 353 Views

Suppose we have strings S and T. We have to count number of distinct sequences of S which is equal to T.We know that a subsequence of a string is a new string which is formed from the original string by removing some (can be none) of the characters without disturbing the relative positions of the remaining characters. (Like, "ACE" is a subsequence of "ABCDE" while "AEC" is not).If the input strings are “baalllloonnn” and “balloon”, then there will be 36 different ways to select.To solve this, we will follow these steps −n := size of s, m := size ...

Read More

Advanced Selectors in CSS

AmitDiwan
AmitDiwan
Updated on 11-Mar-2026 844 Views

The Advanced Selectors in CSS includes Adjacent Sibling selector, attribute selector, direct child selector, nth-of-type selector, etc. It also includes General Sibling Selector, an example is shown below:h1 ~ h3Example of direct child selector −div > spanFollowing is the code showing advanced selectors in CSS −Example #red {    color: red; } .green {    background: green; } ul:nth-of-type(1) {    background: rgb(0, 174, 255); } ul + h3 {    border: 4px solid rgb(19, 0, 128); } a[href="https://www.wikipedia.org"] {    font-size: 25px; } h1 ~ h3 {    font-size: 40px; } div > span {    background-color: ...

Read More

Find common elements in list of lists in Python

Pradeep Elance
Pradeep Elance
Updated on 11-Mar-2026 2K+ Views

It is possible to have a list whose inner elements are also lists. In such cases we may come across a need when we have to find out the common elements among these inner lists. In this article we will find out the approaches to achieve this.With map and intersectionIntersection is a simple mathematical concept of finding the common elements between different sets. Python has the set method which returns a set that contains the similarity between two or more sets. So we first convert the elements of the list into set through a map function and then apply the ...

Read More

Expression Add Operators in C++

Arnab Chakraborty
Arnab Chakraborty
Updated on 11-Mar-2026 356 Views

Suppose we have a string that holds only digits from 0 to 9. And one target value is given. We have to return all possibilities to add binary operators +, - and * into the digits to get the target values. So if the input is like “232” and the target is 8, then the answer will be [“2*3+2”, “2+3*2”]To solve this, we will follow these steps −Define a method called solve(), this will take index, s, curr, target, temp, mult −if idx >= size of s, then, if target is same as curr, then, insert temp at the end ...

Read More

JavaScript - Get the text of a span element

AmitDiwan
AmitDiwan
Updated on 11-Mar-2026 3K+ Views

To get the text of the span element in JavaScript, the code is as follows −Example Document    body {       font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;    }    .sample {       font-size: 18px;       font-weight: 500;    } JavaScript Date Methods This is some sample text inside a span element CLICK HERE Click on the above button to get the span text    let sampleEle = document.querySelector(".sample");    let spanEle = document.querySelector(".test");    document.querySelector(".Btn").addEventListener("click", () => {       sampleEle.innerHTML = "The span text is = " + spanEle.innerHTML;    }); OutputOn clicking the “CLICK HERE” button −

Read More

Find Median from Data Stream in C++

Arnab Chakraborty
Arnab Chakraborty
Updated on 11-Mar-2026 526 Views

Suppose we have a data stream, in that stream some data element may come and join, we have to make one system, that will help to find the median from the data. As we know that the median is the middle data of a sorted list, if it list length is odd, we can get the median directly, otherwise take middle two elements, then find the average. So there will be two methods, addNum() and findMedian(), these two methods will be used to add numbers into the stream, and find the median of all added numbersTo solve this, we will ...

Read More

Remove Invalid Parentheses in C++

Arnab Chakraborty
Arnab Chakraborty
Updated on 11-Mar-2026 408 Views

Suppose we have a string of parentheses. We have to remove minimum number of invalid parentheses and return the well formed parentheses strings, So if the input is like “()(()()”, so the result will be [“()()()”, “()(())”]To solve this, we will follow these steps −Define a method called solve(), this will take pos, left, right, l, r, string array res and string temp.if pos is same as size of s, then, if left is same as 0 and right is same as 0, then, if (m[temp] is non-zero) is false, then, insert temp at the end of resm[temp] := 1returnif ...

Read More

Burst Balloons in C++

Arnab Chakraborty
Arnab Chakraborty
Updated on 11-Mar-2026 516 Views

Suppose we have n balloons, these are indexed from 0 to n-1. Here each balloon is painted with a number on it represented by one array called nums. we have to burst all the balloons. If we burst balloon i we will get nums[i – 1] * nums[i] * nums[i + 1] number of coins. After the burst, the i – 1 and i + 1 then becomes adjacent. We have to find the maximum coins to collect by bursting the balloons wisely.So if the input is like [3, 1, 5, 7], then the result will be 148. Initially the ...

Read More
Showing 5261–5270 of 61,248 articles
« Prev 1 525 526 527 528 529 6125 Next »
Advertisements