Advertisement

Codechef November Long Challenge 2019 | HRDSEQ | Hard Sequence - Solution

Codechef November Long Challenge 2019 | HRDSEQ | Hard Sequence - Solution Codechef November Long Challenge 2019 | HRDSEQ | Hard Sequence - Solution

Problem :

Master Competitive Programming. Start your journey from where you are :


Problem Statement:
Given a sequence and the steps to create that sequence we need to find the number of occurrences of N-th element in the sequence among the first N numbers.

Solution -
Follow the steps to create the given sequence
Use extra array so that creation time remains O(n) and space complexity also O(n), but both are small because of the constraints.

Then count the occurrences of the N-th element in the sequence among the first N numbers.

Time Complexity : O(T*N)
Concepts used: Loop, Linear search for counting

Follow Instagram for more such useful content :

Facebook :

Solution

Post a Comment

0 Comments