insidcode
ProblemsDuelLeaderboardStats
Sign In
  1. Home
  2. Problems
  3. Print numbers in a spiral-like pattern (conceptual dry run).

Print numbers in a spiral-like pattern (conceptual dry run).

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 window size K on line 3, print maximum element for each sliding window of size K separated by space. 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: 8 1 3 -1 -3 5 3 6 7 3

Output: 3 3 5 5 6 7

Explanation: Sample execution for input 8 1 3 -1 -3 5 3 6 7 3