Create Deque

Easy Deque PRO
🔒 Login to Unlock

Problem Statement

Write a C program to initialize a Double-Ended Queue (Deque) with a given capacity and print its initial state.

Input Format

An integer capacity value.

Output Format

Print the initialized capacity and initial front/rear pointers.

Constraints

1 <= capacity <= 100

Sample Input

5

Sample Output

Capacity: 5, Front: -1, Rear: -1

Explanation

Initialize deque capacity with front = -1 and rear = -1 to represent an empty deque.

Starter Code

#include <stdio.h>
#include <stdlib.h>

struct Deque {
    int *arr;
    int capacity;
    int front;
    int rear;
};

int main() {
    int cap;
    if (scanf("%d", &cap) == 1) {
        // Write your code here to create deque
    }
    return 0;
}

Limits

  • Time Limit: 1s
  • Memory Limit: 256MB

Embedded C Programming

Updated: March 15, 2026
Intermediate

Embedded systems rely on efficient low-level programming to interact directly with hardware. In this course, you will learn how to write practical Embedded C programs used in real microcontroller-based systems. Rather than focusing only on theory, this course follows a practice-driven approach. Each lesson includes hands-on coding exercises that simulate real firmware development tasks used