Блог пользователя bhagya_rana

Автор bhagya_rana, 3 года назад, По-английски

Combined Questions PDF Link

Q1) Two Operations

Problem Description

Q1

Example Test Case + Explanation

Q1-TestCase

Q2) Aesthetic Permutation

Problem Description

Q2

Example Test Case + Explanation

Q2-TestCase

Q3) Treasure Hunt in the city

Problem Description

Q3-A
Q3-B

Example Test Case + Explanation

Q3-TestCase

Q4) Expected Path Length

Problem Description

Q4

Example Test Case + Explanation

Q4-TestCase

Q5) Intersection of segments

Problem Description

Q5

Example Test Case + Explanation

Q5-TestCase

Q6) Possible Array

Problem Description

Q6-A
Q6-B

Example Test Case + Explanation

Q6-TestCase

Please share your Approaches and Solution for problems in comments.

If this Discussion was Helpful, Please do Upvote this Blog for Greater Audience Reach.

Disclaimer : This Thread is made for Discussion of Codeagon-2023-Contest, which was held on 8-Jan-2023 from 12 PM to 3 PM I.S.T. The Contest has been officially Ended and this Discussion Thread is Published after the Contest.

  • Проголосовать: нравится
  • +52
  • Проголосовать: не нравится

»
3 года назад, скрыть # |
 
Проголосовать: нравится +3 Проголосовать: не нравится

Appreciate your efforts. How to solve 6th?

»
3 года назад, скрыть # |
Rev. 7  
Проголосовать: нравится +12 Проголосовать: не нравится
Problem 1
Problem 2
Problem 3
Problem 4
Problem 5
Problem 6

I will update the solution to problem 6 in a more detailed way after some time.

»
3 года назад, скрыть # |
 
Проголосовать: нравится +3 Проголосовать: не нравится

Did you guys receive any acknowledgement mail (like successfully completed the test) after completion of the test? After 3hrs I was taken to a page that says couldn't access test instead of test completed page.

»
3 года назад, скрыть # |
 
Проголосовать: нравится +3 Проголосовать: не нравится
For me, after I submitted, it came as correct answer, does that mean I passed all test cases?
»
3 года назад, скрыть # |
 
Проголосовать: нравится +1 Проголосовать: не нравится

Can anyone explain solution of problem 2.

»
3 года назад, скрыть # |
 
Проголосовать: нравится +4 Проголосовать: не нравится
Expected Path Length:

Using linearity of expectation, Expected Value of Steps = 1 / A * (summation of Exp(x) over all 'x') , where 1 <= x <= A

Let divisors(x) = number of divisors of 'x'.

Exp(x) = 1 / divisors(x) * (1 + summation of Exp(x / d) over all divisors 'd')

Since A <= 10 ^ 5, it can be calculated using sieve.

»
3 года назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Problem 3

Hint 1
Hint 2
Hint 3
Hint 4
Hint 5
Hint 6
Solution
Code
Bonus Hint

Thanks for reading! Please point out if I've made any mistake. Feel free to share any better or more interesting approach.

»
3 года назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

How much problems we have to solve to get shortlisted for interviews?

»
3 года назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Q-2 Aesthetic Permutation solution using DP:

Notice that there would be a total of b sequences of type Sequence1 -> 1, 1+b, 1+2*b ... Sequence2 -> 2, 2+b, 2+2*b ...

Now out of b, b-n%b sequence will have size of n/b and rest (n%b) will have size of n/b+1.

Each sequence should have elements in sorted form. Now dp comes into the picture to decide which sequence should get elements from current_index to current_index + (size_of_chosen_sequence)-1.

C++ code
»
3 года назад, скрыть # |
 
Проголосовать: нравится +24 Проголосовать: не нравится

Anybody got any mail about selection? Or when is the result anybody knows?

»
3 года назад, скрыть # |
Rev. 2  
Проголосовать: нравится +8 Проголосовать: не нравится

Anyone from the 2023 batch received any mail for the next steps?