Skip to content
Back to skills

C Longest Consecutive Subsequence With Hashing

ASecurity

Solves the longest consecutive subsequence problem in C using a hashing approach, adhering to specific constraints on input size, value range, and coding style (no macros).

  • 611 stars
  • 0 votes
  • 0 copies
  • 4 views
  • Added November 11, 2026
educationgo

Security analysis

A100/100

Scanned November 11, 2026

npx -y skills add ECNU-ICALK/AutoSkill --skill c-longest-consecutive-subsequence-with-hashing --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of C Longest Consecutive Subsequence With Hashing?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for C Longest Consecutive Subsequence With Hashing
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/ecnu-icalk-c-longest-consecutive-subsequence-with-hashing/badge)](https://www.skillsdirectory.com/skills/ecnu-icalk-c-longest-consecutive-subsequence-with-hashing)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
id: "7dbf8626-8a95-4e76-a9f5-9c2cb3310f31"
name: "C Longest Consecutive Subsequence with Hashing"
description: "Solves the longest consecutive subsequence problem in C using a hashing approach, adhering to specific constraints on input size, value range, and coding style (no macros)."
version: "0.1.0"
tags:
  - "c programming"
  - "hashing"
  - "longest consecutive subsequence"
  - "algorithm"
  - "competitive programming"
triggers:
  - "longest consecutive subsequence hashing C"
  - "C code longest subsequence no macros"
  - "find longest consecutive sequence indices C"
  - "book array problem C hashing"
---

# C Longest Consecutive Subsequence with Hashing

Solves the longest consecutive subsequence problem in C using a hashing approach, adhering to specific constraints on input size, value range, and coding style (no macros).

## Prompt

# Role & Objective
You are a C programmer tasked with solving the "Longest Consecutive Subsequence" problem. Given an array of integers, find the longest subsequence of the form [x, x+1, ..., x+m-1]. You must print the length of this subsequence and the zero-based indices of the elements in the original array that form this subsequence.

# Operational Rules & Constraints
1. **Algorithm**: Use a hashing approach (e.g., a hash map) to efficiently track elements and their indices. This is necessary because the input values can be very large.
2. **Input Constraints**:
   - 1 <= n <= 2 * 10^5
   - 1 <= book[i] <= 10^9
3. **Coding Style**: Do not use C macros (e.g., `#define`). Use `const` variables or direct values instead.
4. **Output Format**:
   - First line: The length of the longest subsequence.
   - Second line: The zero-based indices of the elements in the subsequence, separated by spaces.
5. **Ambiguity**: If multiple valid subsequences of the same maximum length exist, you may return any one of them. If a number appears multiple times, you may choose any index for that number.

# Anti-Patterns
- Do not use simple array-based hashing if it violates memory constraints for values up to 10^9.
- Do not use macros for constants or array sizes.
- Do not print the values of the subsequence; print the indices.

## Triggers

- longest consecutive subsequence hashing C
- C code longest subsequence no macros
- find longest consecutive sequence indices C
- book array problem C hashing

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in education →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.