conversations
listlengths
2
2
[ { "from": "human", "value": "Implement a custom v-permission directive in Vue 3 that conditionally removes elements from the DOM based on user role. It needs to listen to a reactive UserStore and re-evaluate instantly if the role changes dynamically via WebSocket." }, { "from": "gpt", "value": "...
[ { "from": "human", "value": "Build a Next.js app with GraphQL using GraphQL Code Generator for typed hooks with TypedDocumentNode. Implement optimistic UI updates in the Apollo cache for a Like mutation that toggles instantly before the server responds and rolls back on error." }, { "from": "gpt", ...
[ { "from": "human", "value": "Develop a SvelteKit e-commerce checkout that handles Stripe webhooks to fulfill orders. Verify the Stripe signature with the raw body and implement idempotency so duplicate webhook events don't create duplicate orders." }, { "from": "gpt", "value": "<think>The user w...
[ { "from": "human", "value": "Create a Bootstrap 5 admin panel with a dynamic theme switcher that swaps the stylesheet href to load a different theme file instead of just toggling a class. Persist the selection in localStorage to avoid flash of unstyled content." }, { "from": "gpt", "value": "<th...
[ { "from": "human", "value": "Implement a CSS-only carousel with scroll-snap-type and accessibility. Add a small bit of JavaScript using IntersectionObserver to detect the active slide and update dot pagination indicators. Make sure keyboard tab navigation works logically." }, { "from": "gpt", "v...
[ { "from": "human", "value": "Design a Holy Albatross layout using CSS Flexbox with container queries. The component should display as 3 columns if there's room but switch to a single column stack if the container is too narrow, using the flex-basis calculation hack or native @container queries." }, { ...
[ { "from": "human", "value": "Create a landing page with parallax effects optimized for 60fps. Only use transform translate3d and opacity, use will-change sparingly, implement the update loop with requestAnimationFrame, and make sure event listeners are passive." }, { "from": "gpt", "value": "<th...
[ { "from": "human", "value": "Build a themeable SvelteKit design system with a no-JS fallback. The theme toggle should work using a URL query param or CSS :target hack when JS is disabled, then hydrate the theme state without layout shift when JS loads." }, { "from": "gpt", "value": "<think>Here'...
[ { "from": "human", "value": "Build a Tailwind CSS plugin using matchUtilities to create a dynamic text-shadow utility that allows arbitrary values like text-shadow-[2px_2px_4px_red]. Also expose default theme values like shadow-sm and shadow-md in the config." }, { "from": "gpt", "value": "<thin...
[ { "from": "human", "value": "Build an Angular PWA with version control where the ServiceWorkerModule doesn't auto-update. Listen to SwUpdate.available and show a toast saying \"New version available. Click to Reload.\" Only activate the new service worker when clicked." }, { "from": "gpt", "valu...
[ { "from": "human", "value": "Create a Vue.js plugin for global error handling using app.config.errorHandler. Capture component errors, promise rejections, and API errors. Deduplicate similar errors within 1 second before sending to a logging service to prevent flooding." }, { "from": "gpt", "val...
[ { "from": "human", "value": "Design a responsive UI kit using Turborepo where Package A is core logic and Package B is React components. Make Package B tree-shakeable with sideEffects false and export individual CSS modules for each component." }, { "from": "gpt", "value": "<think>Here's a think...
[ { "from": "human", "value": "Implement CSS architecture using ITCSS with strictly organized imports: Settings, Tools, Generic, Elements, Objects, Components, Trumps. Explain where a grid system vs a card component vs a utility class belongs in this hierarchy." }, { "from": "gpt", "value": "<thin...
[ { "from": "human", "value": "Implement A/B testing at the edge with Vercel or Cloudflare middleware. Check for an ab-test cookie, assign a variant randomly if missing, set the cookie, and rewrite the URL to the variant path with less than 10ms latency." }, { "from": "gpt", "value": "<think>The u...
[ { "from": "human", "value": "Implement a multi-theme React system that listens to the system preference matchMedia for dark mode. If the user hasn't manually overridden the theme, automatically switch when the OS theme changes. Sync state across tabs using the storage event." }, { "from": "gpt", ...
[ { "from": "human", "value": "Develop an animated navigation menu using an SVG gooey effect filter with feGaussianBlur and feColorMatrix. When hovering over a menu item, a blob should morph and move to that item using spring physics or CSS variables." }, { "from": "gpt", "value": "<think>Here's a...
[ { "from": "human", "value": "Create a custom form validation framework in vanilla JS using the native Constraint Validation API with setCustomValidity. Implement async validation like username availability that debounces input, sets a pending validity state, and updates the UI on completion." }, { "...
[ { "from": "human", "value": "Create a masonry layout using grid-template-rows: masonry for Firefox with a JavaScript fallback for other browsers that calculates item heights and uses absolute positioning or CSS columns to pack items without vertical gaps." }, { "from": "gpt", "value": "<think>He...
[ { "from": "human", "value": "Build a Vue.js offline-first app using idb for IndexedDB. When creating a todo, write to IDB immediately and show it in the UI. A background sync manager should detect network restoration, push the queue to the API, and handle ID conflicts." }, { "from": "gpt", "valu...
[ { "from": "human", "value": "Design a real-time Angular dashboard using a webSocket subject with a buffering strategy. High-frequency updates like stock ticks should be collected with bufferTime(200) and processed in chunks to prevent change detection from freezing the browser." }, { "from": "gpt", ...
[ { "from": "human", "value": "Implement SvelteKit with headless CMS live preview where the CMS loads the site in an iframe. Use window.postMessage to send draft content from the CMS to the SvelteKit app, applying overrides to the store state instantly without page reload." }, { "from": "gpt", "va...
[ { "from": "human", "value": "Develop a Tailwind plugin for fluid typography that generates utility classes using CSS clamp(). The formula should linearly interpolate font size between minimum and maximum viewport widths." }, { "from": "gpt", "value": "<think>1. **Understand the Goal:** The user...
[ { "from": "human", "value": "Implement the Raft consensus algorithm leader election in Go. Handle the split vote scenario where two nodes candidate simultaneously using randomized election timeouts. Simulate network packet loss in tests to prove the system converges on a leader." }, { "from": "gpt",...
[ { "from": "human", "value": "Develop a multi-threaded C file server using sendfile() for zero-copy transfer directly from disk cache to network socket. Benchmark the CPU usage difference against a standard read/write loop." }, { "from": "gpt", "value": "<think>The user wants a C program that imp...
[ { "from": "human", "value": "Implement a Unix-like permission model for a toy filesystem using capability-based security. Instead of ACLs, processes must possess specific tokens to access resources. Implement token inheritance for child processes and token revocation." }, { "from": "gpt", "value...
[ { "from": "human", "value": "Create a monorepo boilerplate using PNPM workspaces with shared tsconfig and eslintrc in a packages/config folder. The Next.js app in apps/web should import UI components from packages/ui with hot module replacement working across package boundaries." }, { "from": "gpt",...
[ { "from": "human", "value": "Generate a T3 Stack boilerplate with Next.js, tRPC, and Prisma. Implement rate limiting on tRPC procedures using upstash/ratelimit and add a protected procedure middleware that verifies sessions and throws typed tRPC errors if invalid." }, { "from": "gpt", "value": "...
[ { "from": "human", "value": "Provide a FastAPI + Celery boilerplate using RabbitMQ as the broker. Implement progress tracking where the API returns a task_id, the client polls a status endpoint, and the Celery task updates its state to Redis so the client can show a progress bar." }, { "from": "gpt"...
[ { "from": "human", "value": "Generate a React Native boilerplate with CodePush for OTA updates. The CI pipeline should release a JS bundle update on push to main, but force a native binary build if native dependencies in package.json changed." }, { "from": "gpt", "value": "<think>The user wants ...
[ { "from": "human", "value": "Create a Dockerized Flask boilerplate with multi-stage builds. The first stage installs build dependencies and compiles wheels, the second copies only compiled wheels for a minimal distroless or Alpine image to reduce attack surface." }, { "from": "gpt", "value": "<t...
[ { "from": "human", "value": "Provide a NestJS boilerplate with event sourcing using EventStoreDB. The write side appends events while a separate projection process reads the event stream and updates a MongoDB read view model." }, { "from": "gpt", "value": "<think>The user wants a NestJS boilerpl...
[ { "from": "human", "value": "Build a Go microservice boilerplate with graceful shutdown. When receiving SIGTERM, stop accepting new requests, wait for active requests to finish with a timeout, and close database connections properly before exiting." }, { "from": "gpt", "value": "<think>The user ...
[ { "from": "human", "value": "Build a SvelteKit app with magic link auth without using a library. Generate a cryptographically secure token, store the hash in DB, email the link. In the callback, verify the token, create a session ID, store it in an HttpOnly Secure SameSite=Strict cookie, and handle token ex...
[ { "from": "human", "value": "Provide a Python data science boilerplate integrating Kedro for pipeline management. Define modular pipelines with inputs and outputs in catalog.yml and implement a hook that validates data schema with Great Expectations before nodes run." }, { "from": "gpt", "value"...
[ { "from": "human", "value": "Create a Kotlin Ktor boilerplate with WebSockets using the actor model. Each connected client spawns a coroutine actor, and a broadcast actor manages active clients and pushes messages to them concurrently." }, { "from": "gpt", "value": "<think>1. **Understand the G...
[ { "from": "human", "value": "Generate a Vue 3 + Vite boilerplate with unit testing using Vitest in a JSDOM environment. Mock API calls with MSW so tests don't hit real endpoints but simulate network latency and error states." }, { "from": "gpt", "value": "<think>Here's a thinking process that le...
[ { "from": "human", "value": "Build a Node.js CLI tool boilerplate using Ink for React-based terminal UI with spinners and progress bars. Handle SIGINT to cleanup child processes if the user kills the CLI mid-operation." }, { "from": "gpt", "value": "<think>Here's a thinking process that leads to...
[ { "from": "human", "value": "Build a Flutter + Firebase boilerplate with Firestore security rules unit tests. Include a local emulator suite setup and a test script that verifies user A cannot read user B's private document before deployment." }, { "from": "gpt", "value": "<think>1. **Understan...
[ { "from": "human", "value": "Provide a Ruby on Rails API boilerplate compliant with JSON:API standard using jsonapi-serializer. Implement compound documents with sideloading related resources via ?include=author,comments to reduce HTTP requests." }, { "from": "gpt", "value": "<think>The user wan...
[ { "from": "human", "value": "Generate a C# ASP.NET Core boilerplate with structured logging using Serilog sinking to Elasticsearch. Implement middleware that captures correlation IDs from request headers and attaches them to every log scope for distributed tracing." }, { "from": "gpt", "value": ...
[ { "from": "human", "value": "Create a Rust web service boilerplate using SQLx for async database interaction. Implement the outbox pattern where saving a record also saves an event to an outbox table in the same transaction, with a background worker publishing to Kafka." }, { "from": "gpt", "val...
[ { "from": "human", "value": "Create a Django boilerplate with tenant schemas using django-tenant-schemas. Route requests to specific PostgreSQL schemas based on subdomain and include a management command to migrate all tenant schemas in parallel." }, { "from": "gpt", "value": "<think>The user wa...
[ { "from": "human", "value": "Build an Elixir Phoenix boilerplate using Presence to track online users. Implement a cluster setup with libcluster so presence information syncs across distributed Erlang nodes automatically when deployed to multiple instances." }, { "from": "gpt", "value": "<think>...
[ { "from": "human", "value": "Implement dynamic server-side data fetching in SvelteKit using the handleFetch hook. Intercept all server-side fetch requests and inject an internal service-to-service API key or mTLS certificate automatically for internal microservice calls." }, { "from": "gpt", "va...
[ { "from": "human", "value": "Create an advanced React drag-and-drop kanban board with optimistic reordering. When a card is dropped, update local state instantly and send the new order to the backend. If validation fails like a locked board, rollback the UI with a toast error." }, { "from": "gpt", ...
[ { "from": "human", "value": "Develop an Angular app with reactive forms and a custom ControlValueAccessor for a complex multi-select dropdown with chips. It must integrate seamlessly with formControlName and support touched, dirty, and disabled states correctly." }, { "from": "gpt", "value": "<t...
[ { "from": "human", "value": "Design a multi-theme responsive layout using CSS variable swap strategy. Define semantic colors in :root, redefine them in a .dark-theme class, and ensure smooth transitions between themes with transition on background-color." }, { "from": "gpt", "value": "<think>Her...
[ { "from": "human", "value": "Build a Vue 3 app that exports framework-agnostic web components using defineCustomElement. Implement shadow DOM style injection where global Tailwind styles are extracted and injected into each component's shadow root at runtime so they work when embedded in a React app." }, ...
[ { "from": "human", "value": "Create a CSS-only image gallery using container queries with the cq-fill technique. It should switch from 1-column to masonry based on container width and use scroll-driven animations to fade images in as they enter the viewport without any JavaScript." }, { "from": "gpt...
[ { "from": "human", "value": "Build an Angular component library with visual regression testing. Configure Storybook with Chromatic or a local Puppeteer script where CI fails if pixel difference exceeds 0.1%. Implement knobs where checking a box toggles a specific Angular directive on the component." }, ...
[ { "from": "human", "value": "Create a progressive image loading strategy using the Blurhash technique. The server computes a short hash string, the client decodes it into a small canvas placeholder immediately, then cross-fades to the full image once loaded. Package this in a reusable lazy-img web component...
[ { "from": "human", "value": "Implement a React chat app with GraphQL subscriptions that handles socket reconnection and missed messages. If the WebSocket drops for 10 seconds, queue outgoing messages, then on reconnection send the queue and request a catch-up query for missed messages using a cursor ID." ...
[ { "from": "human", "value": "Develop a SvelteKit site with FLIP animations across routes. When clicking a card in a grid on Route A, it should morph into the header of the detail page on Route B by calculating the bounding box delta and applying the inverse transform during navigation." }, { "from":...
[ { "from": "human", "value": "Implement internationalized routing in Next.js without the built-in i18n. Write custom middleware that detects geo-IP from Vercel headers and rewrites French users from /en to /fr unless they have a NEXT_LOCALE cookie overriding the geo-detection." }, { "from": "gpt", ...
[ { "from": "human", "value": "Design a CSS architecture for legacy migration with a scoped reset. Create a .new-app class that resets all global styles from Bootstrap or Foundation inherited from the legacy parent page so new React components inside look consistent regardless of CSS pollution." }, { ...
[ { "from": "human", "value": "Create a Vue plugin for a typed event bus without using mitt. Use TypeScript mapped types so the $emit function autocompletes the payload type based on event name. Add a replay feature where new subscribers can request the last N events of a specific topic." }, { "from":...
[ { "from": "human", "value": "Build an Angular micro-frontend architecture using Module Federation that shares the Angular core singleton. If shell and remote both use Angular 17, share the runtime. If remote uses Angular 16, gracefully fallback to downloading its own runtime for version mismatch handling." ...
[ { "from": "human", "value": "Implement a multiplayer game backend in Node.js using UDP for player movement updates and TCP for chat and inventory. Implement client-side prediction and server reconciliation to hide latency, with the server keeping a buffer of the last 30 frames to validate move timestamps." ...
[ { "from": "human", "value": "Build a complex React form generator where the schema is a recursive JSON tree with conditional logic like show Field B if Field A is greater than 10. Implement the logic engine using topological sort to determine evaluation order so updates propagate correctly in a single rende...
[ { "from": "human", "value": "Create a responsive Tailwind admin dashboard with container-based resizing. Charts using Chart.js should listen to their div container resize, not the window. Use a ResizeObserver hook to trigger chart redraws only when the layout panel actually changes size like on sidebar togg...
[ { "from": "human", "value": "Implement a Next.js styling solution using Vanilla Extract for zero-runtime CSS-in-JS. Configure the build to output atomic CSS classes and implement a sprinkles configuration that restricts developers to only use values defined in the design token TypeScript theme." }, { ...
[ { "from": "human", "value": "Create a reusable animation library using the Web Animations API. Create a standard animateEntry function that works on both DOM nodes and shadow DOM nodes, returns a Promise that resolves when finished, and handles prefers-reduced-motion automatically." }, { "from": "gp...
[ { "from": "human", "value": "Design a modular Pinia state management system with store hydration from localStorage with versioning. If saved state is version 1.0 and current app is 1.1, run a migration function to transform the old state structure before loading it into the store." }, { "from": "gpt...
[ { "from": "human", "value": "Implement Angular Universal API pre-rendering with a cache warming script. Before deploying, crawl the sitemap, trigger SSR render for each route, save HTML to Redis cache, and only switch the load balancer to the new deployment once 90% of high-traffic pages are cached." }, ...
[ { "from": "human", "value": "Implement Vue routing guards with a dirty form guard. If the user tries to navigate away with unsaved changes, show a native browser confirm dialog. If they cancel, abort navigation. This must work for both in-app router pushes and browser back/forward buttons." }, { "fr...
[ { "from": "human", "value": "Create a CSS-only tooltip system using the CSS Anchor Positioning API. The tooltip should automatically flip to the top if there isn't enough space on the bottom. Provide a JavaScript fallback using floating-ui for browsers that don't support anchor positioning yet." }, { ...
[ { "from": "human", "value": "Build a Next.js blog platform with ISR and on-demand revalidation. Create a secure API route that the headless CMS webhooks call with the specific slug changed, updating the static page instantly without waiting for a revalidation timer." }, { "from": "gpt", "value":...
[ { "from": "human", "value": "Create a CSS-only accordion using details and summary elements. Animate the height opening using the grid-template-rows 0fr to 1fr transition trick. Make sure Ctrl+F find works so the browser automatically expands the detail if searched text is hidden inside." }, { "from...
[ { "from": "human", "value": "Design an Angular multi-language form validation system without separate translation files. Create a translation directive that wraps mat-error, accepts the error key like required or minlength with parameters, and interpolates the correct localized string dynamically." }, {...
[ { "from": "human", "value": "Design an algorithm to find the median of two sorted arrays with O(log(min(n,m))) time complexity. Use binary search on partition points, handle edge cases where one array is empty or arrays have uneven lengths, and provide a mathematical proof of correctness in comments." }, ...
[ { "from": "human", "value": "Implement a Vue app with SSR handling async data prefetching on the server. The server-entry.js must wait for all onServerPrefetch hooks to resolve and serialize state into window.__INITIAL_STATE__ to prevent the client from re-fetching and causing hydration mismatch." }, { ...
[ { "from": "human", "value": "Create a solution to detect deadlocks in a distributed system using the Chandy-Misra-Haas algorithm. Messages are passed between processes to determine if a cycle exists in the resource dependency graph." }, { "from": "gpt", "value": "<think>The user wants a solution...
[ { "from": "human", "value": "Solve the maximum subarray problem using Kadane's algorithm, then extend it to the maximum submatrix sum problem for an N x N matrix with O(N^3) complexity." }, { "from": "gpt", "value": "<think>We need to solve the maximum subarray problem using Kadane's algorithm. ...
[ { "from": "human", "value": "Derive the wave equation for the electric field in vacuum from Maxwell's equations. Use the curl of curl identity and show the wave speed equals c." }, { "from": "gpt", "value": "<think>We need to derive the wave equation for the electric field in vacuum from Maxwell...
[ { "from": "human", "value": "Build fraud detection handling imbalanced data with SMOTE to generate synthetic fraud cases. Train an XGBoost classifier and evaluate with area under precision-recall curve, not accuracy." }, { "from": "gpt", "value": "<think>The user wants a Python code solution for...
[ { "from": "human", "value": "Compute the convex hull using the monotone chain algorithm. Sort points by X-coordinate then build the upper hull and lower hull separately in O(n) time after sorting." }, { "from": "gpt", "value": "<think>We need to implement convex hull using monotone chain algorit...
[ { "from": "human", "value": "Encrypt files using Fernet symmetric encryption from cryptography. Derive the key from a user password using PBKDF2HMAC with a salt and 100,000 iterations. Prepend the unencrypted salt to the output file for later decryption." }, { "from": "gpt", "value": "<think>The...
[ { "from": "human", "value": "Build sentiment analysis from scratch with a Naive Bayes classifier without sklearn or NLTK. Train on a small hardcoded dataset of positive and negative sentences and implement Laplace smoothing for words not in the training set." }, { "from": "gpt", "value": "<think...
[ { "from": "human", "value": "Build a Twitter bot with a reply listener using the filtered stream endpoint to listen for mentions. Parse tweet text for command keywords like !help, perform the action, and reply to the thread." }, { "from": "gpt", "value": "<think>1. **Understand the Goal:** The ...
[ { "from": "human", "value": "Derive wave functions and energy levels for the infinite square well. Start from the time-independent Schrödinger equation, apply boundary conditions, normalize the wave function, and calculate the expectation value of position for the ground state." }, { "from": "gpt", ...
[ { "from": "human", "value": "Parse Apache log files using regex named groups. Identify hotlinking attempts where the referer doesn't match your domain and the file extension is jpg or png. Output the top 10 offending IPs." }, { "from": "gpt", "value": "<think>The user wants a solution to parse A...
[ { "from": "human", "value": "Clean and normalize text handling Unicode normalization. Convert to NFKD form to separate characters from diacritics, then use regex to strip combining marks to convert café to cafe while preserving other ASCII characters." }, { "from": "gpt", "value": "<think>We nee...
[ { "from": "human", "value": "Generate all unique permutations of a multiset without generating duplicates and filtering. Use backtracking with a frequency map or sorting to skip duplicate branches before entering them." }, { "from": "gpt", "value": "<think>We need to generate all unique permutat...
[ { "from": "human", "value": "Implement longest increasing subsequence using the patience sorting approach in O(n log n). Maintain a list of active pile tails and for each number binary search to find the first pile top >= the number and replace it, or start a new pile." }, { "from": "gpt", "valu...
[ { "from": "human", "value": "Send emails with attachments using smtplib and email.mime. Construct a MIME multipart message with both text/plain fallback and text/html body plus a PDF attachment encoded in base64. Handle TLS handshake explicitly." }, { "from": "gpt", "value": "<think>We need to s...
[ { "from": "human", "value": "Detect outliers using the interquartile range method with pandas. Calculate Q1 and Q3, define outliers as values below Q1 - 1.5*IQR or above Q3 + 1.5*IQR, and filter the dataset to remove these rows." }, { "from": "gpt", "value": "<think>The user wants to detect and ...
[ { "from": "human", "value": "Design a skip list with probabilistic balancing. The insert operation flips a coin to determine new node tower height. Search, insert, and delete must achieve O(log n) average time complexity." }, { "from": "gpt", "value": "<think>The user asks: \"Design a skip list ...
[ { "from": "human", "value": "Implement the Knuth-Morris-Pratt algorithm. First compute the longest prefix suffix array and explain in comments how it allows the search index to skip ahead without backtracking in the text string." }, { "from": "gpt", "value": "<think>We need to implement the Knut...
[ { "from": "human", "value": "Plot stock trends by fetching OHLC data with yfinance. Verify with mplfinance then render a custom interactive candlestick chart using Plotly with a Bollinger Bands overlay calculated using pandas rolling standard deviation." }, { "from": "gpt", "value": "<think>The ...
[ { "from": "human", "value": "Implement a simple chatbot with Levenshtein distance matching. Have a dictionary of predefined questions and find the key with lowest edit distance to the user query. Fallback to \"I don't understand\" if confidence is too low." }, { "from": "gpt", "value": "<think>W...
[ { "from": "human", "value": "Build a Python REST API with JWT and implement a custom @require_role('admin') decorator that inspects request context, decodes the JWT, verifies the signature, and checks if the roles claim contains admin before executing the route." }, { "from": "gpt", "value": "<t...
[ { "from": "human", "value": "Batch resize and watermark images using Pillow. The watermark should be a transparent PNG centered on the image using alpha composition, scaling proportionally to always be 20% of the target image width." }, { "from": "gpt", "value": "<think>The user wants a Python s...
[ { "from": "human", "value": "Build a CLI tool to organize files using pathlib with content-addressable storage logic. Rename files to their SHA-256 hash and detect duplicates by deleting the source if a target with the same hash already exists." }, { "from": "gpt", "value": "<think>The user want...
[ { "from": "human", "value": "Compute strongly connected components using Kosaraju's algorithm with two DFS passes: one on the original graph for finish times, one on the transpose graph with reversed edges to find components." }, { "from": "gpt", "value": "<think>The user wants an explanation or...
[ { "from": "human", "value": "Schedule periodic tasks with APScheduler using a SQLAlchemyJobStore so jobs persist across restarts. Create a job that runs every 2nd Friday of the month using a cron trigger expression." }, { "from": "gpt", "value": "<think>1. **Understand the Goal:** The user want...
[ { "from": "human", "value": "Find bridges or critical connections in a network graph using Tarjan's bridge-finding algorithm. Use a single DFS traversal to compute discovery_time and low_link values where a bridge exists if low_link[child] > discovery_time[parent]." }, { "from": "gpt", "value": ...
[ { "from": "human", "value": "Detect and correct errors using Hamming(7,4) codes. Take 4 data bits, generate 3 parity bits, introduce a single-bit flip error, and write logic to identify the exact error position and correct it." }, { "from": "gpt", "value": "<think>We need to detect and correct e...
[ { "from": "human", "value": "Implement a search page in Next.js App Router where search results are server components streamed to the client. Use a client component for the search input that updates URL query params, wrap results in Suspense, and use useTransition to keep old results visible while new ones ...
[ { "from": "human", "value": "Create a leader election algorithm using the Bully algorithm. Processes have IDs and when one notices the leader is down, it sends ELECTION messages to higher ID processes. Handle network timeout scenarios robustly." }, { "from": "gpt", "value": "<think>The user want...
[ { "from": "human", "value": "Schedule tasks with prerequisites using Kahn's algorithm. Detect if a cycle exists for invalid schedules. Output must support parallel execution groups identifying which tasks can run simultaneously at each step." }, { "from": "gpt", "value": "<think>1. **Understand...