Repeat and Missing Number (InterviewBit)

ques: https://www.interviewbit.com/problems/repeat-and-missing-number-array/

soln: https://ide.codingblocks.com/s/291666

my solution is correct, still, it is partially accepted… they are asking for an optimized solution,

How to optimize further?

@chaman9 refer this
contain all the methods
(https://www.geeksforgeeks.org/find-a-repeating-and-a-missing-number/)

yeaah that i can see… i too followed one of those methods

can you please tell whats wrong with mine approach as i am doing in O(N) time and space

@chaman9 it gives mle so you cant use map try do it in o(1) space

see the link for a method which dont consume extra space there are 2 3

okay i will see those methods as well…
i have tried using floyd cycle detection algorithm to find the duplicate and then find the missing integer in O(1) space

can you see where i am wrong?

@chaman9 submit it , it gives runtime for
[2,2]
dry run your code for it to understand the problem

@vatsal38 okay i will try it out