Detect and Remove Loop Problem
Detect and Remove Loop Problem — ExecCode Easy DSA Practice
Solve the Detect and Remove Loop problem on ExecCode. Free online easy DSA practice in Linked List. Write and run code in Java, C++, Python — no signup required to run.
Problem description
Description You are given the input needed to solve Detect and Remove Loop. Your task is to compute the required answer and return 0 (no loop) or 1 (loop handled). A sequence of values is given, and order matters. In Detect and Remove Loop, the goal is to transform, count, or select values according to the exact rule. nums: values; pos: cycle index or -1.
Examples
Input {"nums": [1, 2, 3], "pos": 1}; Output 1. Input {"nums": [1, 2, 3], "pos": -1}; Output 0. Input {"nums": [1, 2, 3, 4], "pos": 0}; Output 1
Constraints
1 <= len(nums) <= 10^4
Practice Detect and Remove Loop free on ExecCode. Browse DSA problems, topic map, and placement guides.