▸case-21 Write a new Python function from scratch using `asyncio` that downloads a list of URLs concurrently and returns their HTTP status codes. | pass→pass | 14,880 | 8,784 | -41% | 1 | 1 | 0% | 2,951 | 1,839 | -38% | 0 | 0 | — |
▸case-01 Review this Python checkout module containing 15 lines of identical tax calculation logic duplicated across three separate conditionals. Demonstrate how to clean up this duplication, including before and after code samples. | pass→pass | 13,320 | 14,075 | +6% | 1 | 1 | 0% | 3,043 | 3,047 | +0% | 0 | 0 | — |
▸case-02 I have a Java method with 5 nested if-else statements inside a loop parsing configuration options. Demonstrate how to reduce its cyclomatic complexity, providing before and after code examples. | pass→pass | 13,274 | 11,006 | -17% | 1 | 1 | 0% | 2,636 | 2,453 | -7% | 0 | 0 | — |
▸case-03 Here is a TypeScript `UserService` class that handles database CRUD operations, emails user notifications, and generates PDF reports. Refactor it to follow the Single Responsibility Principle, showing before and after code snippets. | pass→pass | 10,964 | 9,500 | -13% | 1 | 1 | 0% | 2,682 | 2,051 | -24% | 0 | 0 | — |
▸case-04 This Python payment handler uses a large `if/elif` block checking string type names ('credit_card', 'paypal', 'crypto') to trigger different charging logic. Show how to apply the Open/Closed Principle with before and after code examples. | pass→pass | 9,884 | 9,561 | -3% | 1 | 1 | 0% | 2,194 | 2,238 | +2% | 0 | 0 | — |
▸case-05 A C# hierarchy has `Square` inheriting from `Rectangle` where setting width overrides height, breaking expectations in helper functions. How should this be refactored to adhere to Liskov Substitution Principle? Show before and after code. | pass→pass | 13,027 | 11,258 | -14% | 1 | 1 | 0% | 2,528 | 2,193 | -13% | 0 | 0 | — |
▸case-06 In Go, a monolithic `Worker` interface forces `Printer` types to implement `Scan()` and `Fax()` methods which throw errors. Refactor this to adhere to Interface Segregation Principle, including before and after examples. | pass→pass | 10,132 | 10,384 | +2% | 1 | 1 | 0% | 2,235 | 1,944 | -13% | 0 | 0 | — |
▸case-07 A Node.js `OrderProcessor` directly instantiates `MySQLDatabase` and `SendGridMailer` inside its constructor. Refactor it to follow Dependency Inversion Principle, providing before and after code. | pass→pass | 9,133 | 8,910 | -2% | 1 | 1 | 0% | 1,959 | 2,068 | +6% | 0 | 0 | — |
▸case-08 This C++ array processing function uses variable names like `a`, `tmp`, `flag2`, and `d`. Refactor it to improve naming and readability, presenting before and after code examples. | pass→pass | 11,560 | 13,328 | +15% | 1 | 1 | 0% | 2,209 | 2,827 | +28% | 0 | 0 | — |
▸case-09 A Python shipping module uses switch-case logic on string codes to calculate shipping rates for FedEx, UPS, and DHL. Recommend and implement an appropriate design pattern to refactor this, giving before and after code. | pass→pass | 12,510 | 9,463 | -24% | 1 | 1 | 0% | 2,700 | 2,047 | -24% | 0 | 0 | — |
▸case-10 A Java system constructs notification objects (`SMSNotification`, `EmailNotification`, `PushNotification`) using nested switch statements based on user settings. Suggest a design pattern to refactor this and show before and after code. | pass→pass | 14,409 | 11,543 | -20% | 1 | 1 | 0% | 2,887 | 2,369 | -18% | 0 | 0 | — |
▸case-11 A JavaScript dashboard component manually calls `updateHeader()`, `updateSidebar()`, and `updateFooter()` sequentially after every state change. Refactor this using a suitable design pattern, providing before and after code. | pass→pass | 9,867 | 10,489 | +6% | 1 | 1 | 0% | 2,272 | 2,293 | +1% | 0 | 0 | — |
▸case-12 A C# ordering app creates subclass explosions like `EspressoWithMilkAndSugar` to calculate cost and description. Refactor this using a design pattern, including before and after code. | pass→pass | 11,202 | 11,010 | -2% | 1 | 1 | 0% | 2,325 | 2,388 | +3% | 0 | 0 | — |
▸case-13 In a Python financial calculation script, numbers like `0.0825`, `86400`, and `365` are hardcoded across multiple calculations. Refactor this code for readability and maintainability, providing before and after code examples. | pass→pass | 11,595 | 9,488 | -18% | 1 | 1 | 0% | 2,661 | 1,836 | -31% | 0 | 0 | — |
▸case-14 A Python function contains `if is_active == True and status != False:` and `if not (is_valid == False):`. Refactor these expressions for improved readability, showing before and after code. | pass→pass | 5,325 | 4,929 | -7% | 1 | 1 | 0% | 1,152 | 1,149 | -0% | 0 | 0 | — |
▸case-15 In a Java method, an explicit `for` loop iterates over a list, checks for nulls, transforms strings to uppercase, and appends them to a new list. Suggest a refactoring for readability using modern Java idioms, showing before and after code. | pass→pass | 6,855 | 5,291 | -23% | 1 | 1 | 0% | 1,551 | 1,340 | -14% | 0 | 0 | — |
▸case-16 A 100-line Python function performs data parsing, validation, database insertion, and audit logging all in one continuous block. Show how to refactor this function by extracting logical units, providing before and after code. | pass→pass | 16,472 | 13,316 | -19% | 1 | 1 | 0% | 3,686 | 3,131 | -15% | 0 | 0 | — |
▸case-17 A Python application needs to integrate a new third-party payment API whose method signatures differ completely from the internal `PaymentGateway` interface used across 20 modules. Refactor this using an appropriate design pattern, showing before and after code. | pass→pass | 11,114 | 7,824 | -30% | 1 | 1 | 0% | 2,379 | 2,004 | -16% | 0 | 0 | — |
▸case-18 A C++ file I/O function returns integer error codes like `-1`, `-2`, `-3` while callers use complex nested `if` statements to handle each code. Refactor this to improve error handling and readability, providing before and after code. | pass→fail | 16,201 | 11,459 | -29% | 1 | 1 | 0% | 3,216 | 2,770 | -14% | 0 | 0 | — |
▸case-19 A single React component fetches user profiles from an API, manages modal dialog state, formats currency values, and renders complex HTML markup. How should this be refactored? Provide before and after code. | pass→pass | 13,659 | 12,887 | -6% | 1 | 1 | 0% | 3,268 | 2,968 | -9% | 0 | 0 | — |
▸case-20 A Python function `def divide(a, b): return a / b` throws `ZeroDivisionError` when `b` is 0. Fix the bug so it returns `None` on zero division. | pass→fail | 3,535 | 4,555 | +29% | 1 | 1 | 0% | 671 | 1,038 | +55% | 0 | 0 | — |
▸case-22 Write an SQL query to retrieve total sales per customer for 2025 from a PostgreSQL database with `orders` and `customers` tables. | pass→pass | 5,707 | 8,449 | +48% | 1 | 1 | 0% | 1,245 | 1,899 | +53% | 0 | 0 | — |