Skip to content

Conversation

@modiase
Copy link
Owner

@modiase modiase commented Sep 11, 2025

This change is Reviewable

Summary by CodeRabbit

  • New Features
    • Added a utility to find the insertion index of a target in a sorted list.
    • Introduced permutation ranking and unranking tools for a fixed five-element set, with a simple demo to showcase usage.
  • Tests
    • Added comprehensive test coverage for the insertion-index utility, including edge cases (empty lists, duplicates, boundaries, negatives).

@coderabbitai
Copy link

coderabbitai bot commented Sep 11, 2025

Tip

👮 Agentic pre-merge checks are now available in preview!

Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.

  • Built-in checks – Quickly apply ready-made checks to enforce title conventions, require pull request descriptions that follow templates, validate linked issues for compliance, and more.
  • Custom agentic checks – Define your own rules using CodeRabbit’s advanced agentic capabilities to enforce organization-specific policies and workflows. For example, you can instruct CodeRabbit’s agent to verify that API documentation is updated whenever API schema files are modified in a PR. Note: Upto 5 custom checks are currently allowed during the preview period. Pricing for this feature will be announced in a few weeks.

Please see the documentation for more information.

Example:

reviews:
  pre_merge_checks:
    custom_checks:
      - name: "Undocumented Breaking Changes"
        mode: "warning"
        instructions: |
          Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).

Please share your feedback with us on this Discord post.


📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Free

📥 Commits

Reviewing files that changed from the base of the PR and between 376a863 and 0339d4e.

📒 Files selected for processing (2)
  • algos/leetcode/0035-search-insert-position.py (1 hunks)
  • algos/mathematics/combinatorics/lehmer_code.py (1 hunks)

Note

🎁 Summarized by CodeRabbit Free

Your organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Pro by visiting https://app.coderabbit.ai/login.

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the final PR Bugbot will review for you during this billing cycle.

Your free Bugbot reviews will reset on October 7

Details

You are on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle.

To receive Bugbot reviews on all of your PRs, please upgrade to Bugbot Pro by visiting the Cursor dashboard. Your first 14 days will be free!

for i in range(len(ELEMENTS)):
permutation.append(ELEMENTS[rank % len(ELEMENTS)])
rank //= len(ELEMENTS)

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Missing Return and Incorrect Validation

The unrank function implicitly returns None because it's missing a return statement for the permutation it computes. Additionally, its rank validation incorrectly uses len(ELEMENTS) ** len(ELEMENTS) as the upper bound instead of N_PERMUTATIONS (n!), which is not correct for Lehmer codes.

Fix in Cursor Fix in Web

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants