Jiya Garg

Jiya Garg

2 Articles Published

Articles by Jiya Garg

2 articles

Longest consecutive subsequence in C++

Jiya Garg
Jiya Garg
Updated on 02-Sep-2024 218 Views

Given an array of integers, determine the length of the longest subsequence where the elements are consecutive integers, regardless of their order within the subsequence. Input  arr = {100, 4, 200, 1, 3, 2} Output  Length of the longest consecutive sequence is: 4 Different approaches for longest consecutive subsequence The following are the approaches to get longest consecutive subsequence By sorting the Array By using Set Approach 1: By Sorting the ArrayBelow are the steps to get the longest consecutive subsequence in C++ using Array Sort ...

Read More

Clear bit ranges in given number in C++

C++
Jiya Garg
Jiya Garg
Updated on 02-Sep-2024 424 Views

Given a number n, write C++ program to clear bits in the given range between l and r. Where, 1

Read More
Showing 1–2 of 2 articles
« Prev 1 Next »
Advertisements