insidcode
ProblemsDuelLeaderboardStats
Sign In
  1. Home
  2. Problems
  3. Generate Fibonacci series up to N using recursion.

Generate Fibonacci series up to N using recursion.

Difficulty: Hard

Phase: 6 · Mixed Logical Challenges

XP Reward: 30 XP

Topics: Mixed Logical Challenges, Hard

Supported Languages: Python, JavaScript, C, C++, Java

Problem Description

Given N integers on line 2 and target S on line 3, find 1-based start and end indices of first contiguous subarray summing to S. If none, print -1. Input Format: Read input from standard input (stdin). Output Format: Print the result to standard output (stdout).

Constraints

  • -10^9 <= N <= 10^9

Examples

Example 1

Input: 5 1 2 3 7 5 12

Output: 2 4

Explanation: Sample execution for input 5 1 2 3 7 5 12