First 10 rows of cs
| uuidstring | contentstring | content_formatstring | raw_contentstring | taskstring | analysisstring | solutionstring | teststring | full_contentstring | full_content_formatstring |
|---|---|---|---|---|---|---|---|---|---|
| 34e4f0d3-5671-4a05-b57d-a8be68685d5e | Given a `MedicalRecord` class that contains an `int Index` property and a `string[] zdList` property (where `zdList[0]` is the primary diagnosis code), write a C# static method named `Group` that takes a `MedicalRecord` parameter and returns a string. The method must check if the… | markdown | namespace drg_group.wlmq_2022{ public class EV1 { public static String group(MedicalRecord record) { String[] adrg_zd={"R04.200","R04.800x002","R04.802","R04.900","R05.x00","R05.x01","R05.x02","R06.000","R06.000x002","R06.000x003","R06.100","R0… |
| Given a `MedicalRecord` class that contains an `int Index` property and a `string[] zdList` property (where `zdList[0]` is the primary diagnosis code), write a C# static method named `Group` that takes a `MedicalRecord` parameter and returns a string. The method must check if the… |
| The main algorithm is a straightforward membership check followed by sequential conditional calls. First, create a static `string[]` containing all 39 diagnosis codes exactly as given. Then, in the `Group` method, verify that `record.zdList` is non-null, has at least one element,… |
| using System; using System.Collections.Generic; using System.Linq; namespace DrgTask { // Represents a medical record with an index and a list of diagnosis codes. public class MedicalRecord { public int Index { get; set; } public string[] zdList { get… |
| internal static class Program { public static void Main() { // Reset messages for clean testing DrgTask.Base.Messages.Clear(); // Valid diagnosis, no sub-group match var rec1 = new DrgTask.MedicalRecord { Index = 1, zdList = new string[] {… |
| Given a `MedicalRecord` class that contains an `int Index` property and a `string[] zdList` property (where `zdList[0]` is the primary diagnosis code), write a C# static method named `Group` that takes a `MedicalRecord` parameter and returns a string. The method must check if the… |
| commented standard order |
| aa1dd873-2c01-43a1-b0a6-e4549a9efa53 | /* Write a C# method that takes an integer `n` (where n >= 1) and returns a string representation of four different n×n matrices, labeled "a)", "b)", "c)", and "d)", each separated by a blank line. Matrix "a)" is filled column by column from top to bottom, left to right. Matrix "… | code comment | using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace DifferentPrints { class Prints { // Write a program that fills and prints a matrix of size (n, n) as shown below: (examples for n = 4) {P… | Write a C# method that takes an integer `n` (where n >= 1) and returns a string representation of four different n×n matrices, labeled "a)", "b)", "c)", and "d)", each separated by a blank line. Matrix "a)" is filled column by column from top to bottom, left to right. Matrix "b)"… | The solution requires four distinct filling algorithms. For matrix "a)", simply loop columns outer and rows inner, incrementing a counter. For "b)", simulate movement down/up columns, switching direction at boundaries and moving right after each column is completed; handle the in… | using System; using System.Text; internal static class MatrixPatterns { // Returns a formatted string with four n×n matrices labeled a), b), c), d). public static string Generate(int n) { if (n < 1) throw new ArgumentOutOfRangeException(nameof(n), "n must be … | internal static class Program { public static void Main() { // n=1: all matrices are just "1" string expected1 = "a)\n1 \nb)\n1 \nc)\n1 \nd)\n1 "; Debug.Assert(MatrixPatterns.Generate(1) == expected1, "n=1 failed"); // n=2: verify each… | // Write a C# method that takes an integer `n` (where n >= 1) and returns a string representation of four different n×n matrices, labeled "a)", "b)", "c)", and "d)", each separated by a blank line. Matrix "a)" is filled column by column from top to bottom, left to right. Matrix "… | commented standard order |
| 5f6dfaf9-2064-468b-a621-3608414374f2 | Write a C# method that models a 2D point with a single directed connection to a neighboring point (called a "half-edge"), where each half-edge has an integer ID and a reference to a "Twin" half-edge that links back to the previous point in a circular chain. The method must take a… | no fence | namespace UnityEngine.U2D.Animation.TriangleNet .Topology.DCEL { using System.Collections.Generic; internal class Vertex : Animation.TriangleNet.Geometry.Point { internal HalfEdge leaving; /// <summary> /// Gets or sets a half-edge leavin… | Write a C# method that models a 2D point with a single directed connection to a neighboring point (called a "half-edge"), where each half-edge has an integer ID and a reference to a "Twin" half-edge that links back to the previous point in a circular chain. The method must take a… | The solution simulates a doubly-connected edge list (DCEL)-style traversal. The core algorithm starts at the given vertex's `Leaving` edge and stores its ID as the stopping condition. Then, iteratively: (1) yield the current edge, (2) move to `edge.Twin.Next`. This is done in a `… | using System; using System.Collections.Generic; internal static class HalfEdgeCycleEnumerator { // Returns all half-edges in the cycle starting from the vertex's leaving edge. public static List<HalfEdge> EnumerateCycle(Vertex start) { var result = new List<H… | internal static class Program { public static void Main() { // Build a cycle: E1(1) -> Twin->Next -> E2(3) -> Twin->Next -> back to E1 var e1 = new HalfEdge(1); var t1 = new HalfEdge(2); var e2 = new HalfEdge(3); var t2 = new HalfEd… | Write a C# method that models a 2D point with a single directed connection to a neighboring point (called a "half-edge"), where each half-edge has an integer ID and a reference to a "Twin" half-edge that links back to the previous point in a circular chain. The method must take a… | test-first order |
| bc99466e-0270-46bb-b253-3245f9ba8748 | /* Write a C# static method `FloodFillRegion` in a class `RegionFloodFiller` that simulates region growing on a simplified grid-based triangle mesh. The method takes a 2D integer array `grid` (where non-zero values represent triangle IDs, `-1` represents a removed triangle or wal… | code comment | namespace UnityEngine.U2D.Animation.TriangleNet .Meshing.Iterators { using System; using System.Collections.Generic; using Animation.TriangleNet.Topology; /// <summary> /// Iterates the region a given triangle belongs to and applies an action /// to ea… | Write a C# static method `FloodFillRegion` in a class `RegionFloodFiller` that simulates region growing on a simplified grid-based triangle mesh. The method takes a 2D integer array `grid` (where non-zero values represent triangle IDs, `-1` represents a removed triangle or wall, … | The solution uses an iterative flood-fill algorithm with a queue (BFS) to avoid recursion depth issues. Starting from the seed cell, if it's invalid or doesn't match the region's target ID, return 0 immediately. Otherwise, enqueue the start, set its value to `label`, and incremen… | using System; using System.Collections.Generic; internal static class RegionFloodFiller { // Flood-fill a 2D grid region starting from a seed cell, setting cells to a label, optionally stopping at boundary labels. public static int FloodFillRegion(int[,] grid, int startR… | internal static class Program { public static void Main() { // Test 1: Simple 3x3 all same region int[,] grid1 = { { 1, 1, 1 }, { 1, 1, 1 }, { 1, 1, 1 } }; int count1 = RegionFloodFiller.FloodFillRegion(g… | Write a C# static method `FloodFillRegion` in a class `RegionFloodFiller` that simulates region growing on a simplified grid-based triangle mesh. The method takes a 2D integer array `grid` (where non-zero values represent triangle IDs, `-1` represents a removed triangle or wall, … | standard order |
| bb5c49fe-259b-4ec3-95a3-01d2693d65c9 | /* Write a C# method that simulates a simple multiplication calculator action. Given two integer constants, 112 and 340, the method should return their product using an object-oriented approach where the operation is encapsulated in a class derived from an abstract base action cl… | code comment | using Calculator; namespace Calculator.Multiply { class Action112Multiply340 : MultiplyAction { public override int Process() => 112 * 340; } } | Write a C# method that simulates a simple multiplication calculator action. Given two integer constants, 112 and 340, the method should return their product using an object-oriented approach where the operation is encapsulated in a class derived from an abstract base action class… | The solution requires creating a small object-oriented hierarchy with two classes: an abstract base class `MultiplyAction` that declares the contract (an abstract `Process()` method returning `int`), and a concrete derived class `Action112Multiply340` that provides the specific i… | using System; namespace Calculator { // Abstract base class that defines the multiplication action contract. public abstract class MultiplyAction { // Performs the multiplication and returns the integer result. public abstract int Process(); } } … | internal static class Program { public static void Main() { Calculator.Multiply.Action112Multiply340 action = new Calculator.Multiply.Action112Multiply340(); Debug.Assert(action.Process() == 38080); Debug.Assert(action.Process() == (112 * 340)); … | // Write a C# method that simulates a simple multiplication calculator action. Given two integer constants, 112 and 340, the method should return their product using an object-oriented approach where the operation is encapsulated in a class derived from an abstract base action cl… | standard order |
| 9ba07104-5e07-40f4-8fb8-4131c6e8f0b2 | /* Write a C# method named `LowestCommonAncestor` that accepts the root of a binary tree and two integer values `p` and `q`, and returns the integer value stored in the lowest common ancestor (LCA) node of the nodes with values `p` and `q`. The binary tree is defined by the `Tree… | code comment | namespace LeetCodeSolutions.Solutions.Util { public class TreeNode { public int val; public TreeNode left; public TreeNode right; public TreeNode(int val = 0, TreeNode left = null, TreeNode right = null) { this.val = val; this.left = left; … | Write a C# method named `LowestCommonAncestor` that accepts the root of a binary tree and two integer values `p` and `q`, and returns the integer value stored in the lowest common ancestor (LCA) node of the nodes with values `p` and `q`. The binary tree is defined by the `TreeNod… | The solution uses a recursive depth-first search. At each node, we check if the current node’s value equals either `p` or `q` — if so, we return this value upward. Then we recursively search the left and right subtrees. After both recursive calls return, we examine the results: -… | using System; internal static class BinaryTreeLCA { // Returns the integer value of the lowest common ancestor of nodes with values p and q. // Returns -1 if not found (defensive fallback; both values are guaranteed present). public static int LowestCommonAncestor(Tr… | internal static class Program { public static void Main() { // Build a test tree: // 3 // / \ // 5 1 // / \ / \ // 6 2 0 8 // / \ // 7 4 TreeN… | // Write a C# method named `LowestCommonAncestor` that accepts the root of a binary tree and two integer values `p` and `q`, and returns the integer value stored in the lowest common ancestor (LCA) node of the nodes with values `p` and `q`. The binary tree is defined by the `Tree… | commented standard order |
| 2144fb9f-7543-4e20-a8c2-1c44e5a53da4 | /* Given a list of positive integers representing container capacities and a target number of liters, write a C# method that returns the number of different subsets of containers whose total capacity exactly equals the target liters. A subset is a selection of any number of conta… | code comment | using System.Collections.Generic; using System.Linq; namespace AdventOfCode { public class ContainerFiller { public int TotalCombinationsCount(IEnumerable<int> containers, int liters) { return Enumerable .Range(1, (1 << contain… | Given a list of positive integers representing container capacities and a target number of liters, write a C# method that returns the number of different subsets of containers whose total capacity exactly equals the target liters. A subset is a selection of any number of containe… | The core approach enumerates every possible subset of the container list using bitmasking. With n containers, there are 2^n possible subsets (including the empty subset). For each mask from 0 to 2^n - 1, we check which bits are set: a set bit at position i means container i is in… | using System; using System.Collections.Generic; using System.Linq; internal static class SubsetSumCounter { // Counts subsets of containers whose total capacity equals targetLiters. public static int CountSubsetSums(IEnumerable<int> containers, int targetLiters) { … | internal static class Program { public static void Main() { // Basic cases Debug.Assert(SubsetSumCounter.CountSubsetSums(new int[] { 5, 5, 5 }, 10) == 3); // three pairs of two 5s Debug.Assert(SubsetSumCounter.CountSubsetSums(new int[] { 1, 2, 3 },… | /* Given a list of positive integers representing container capacities and a target number of liters, write a C# method that returns the number of different subsets of containers whose total capacity exactly equals the target liters. A subset is a selection of any number of conta… | solution-first order |
| 9344a12f-b5bd-47ea-b4fd-fc679a6a5be5 | Write a C# method that takes a positive integer `n` and an integer array `values`, and returns a tuple of two integers `(start, end)` representing the range of indices that contains the sum of all elements of `values` divided into `n` nearly equal contiguous partitions, where eac… | no fence | #if PORTABLE namespace MathNet.Numerics { using System; using System.Threading; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct)] public class Serializ… | Write a C# method that takes a positive integer `n` and an integer array `values`, and returns a tuple of two integers `(start, end)` representing the range of indices that contains the sum of all elements of `values` divided into `n` nearly equal contiguous partitions, where eac… | The core algorithm is to divide the array into `n` contiguous segments with sizes as equal as possible. To achieve this, we compute the base size as `values.Length / n` and the remainder as `values.Length % n`. The first `remainder` segments will each have size `baseSize + 1`, an… | using System; using System.Collections.Generic; internal static class ArrayPartitioner { // Splits the given integer array into n contiguous partitions with nearly equal sizes. // Returns a list of Tuple<int,int> where each tuple contains start (inclusive) and end (exclu… | internal static class Program { public static void Main() { // Case 1: Perfectly divisible var result1 = ArrayPartitioner.Partition(new int[] { 1, 2, 3, 4, 5, 6 }, 3); Debug.Assert(result1.Count == 3); Debug.Assert(result1[0].Item1 == 0 && … | Write a C# method that takes a positive integer `n` and an integer array `values`, and returns a tuple of two integers `(start, end)` representing the range of indices that contains the sum of all elements of `values` divided into `n` nearly equal contiguous partitions, where eac… | commented standard order |
| 8bc28f63-b977-456b-8619-e122e8ef2a08 | "Write a C# method that takes a list of 2D points (represented as a custom `Point2D` struct with `do | markdown | "namespace UnityEngine.U2D.Animation.TriangleNet\n{\n using Animation.TriangleNet.Geometry;\n | "Write a C# method that takes a list of 2D points (represented as a custom `Point2D` struct with `do | "The core algorithm is the \"triangle walk\" for point location in a convex triangulation. Starting | "using System;\nusing System.Collections.Generic;\n\npublic readonly struct Point2D\n{\n public d | "internal static class Program\n{\n public static void Main()\n {\n // Convex square: ( | "Write a C# method that takes a list of 2D points (represented as a custom `Point2D` struct with `do | test-first order |
| 6205abc2-cc27-4cab-b5e4-0f6a25c41d08 | "Create a C# method that returns the result of subtracting two fixed integers, 303 and 307, in that | no fence | "using Calculator;\n\nnamespace Calculator.Minus\n{\n class Action303Minus307 : MinusAction\n | "Create a C# method that returns the result of subtracting two fixed integers, 303 and 307, in that | "The solution involves creating two namespaces: `Calculator` for the abstract base class `MinusActio | "using Calculator;\n\nnamespace Calculator\n{\n public abstract class MinusAction\n {\n | "internal static class Program\n{\n public static void Main()\n {\n Debug.Assert(FixedS | "Create a C# method that returns the result of subtracting two fixed integers, 303 and 307, in that | standard order |