{ "id": 2304, "name": "cells_in_a_range_on_an_excel_sheet", "difficulty": "Easy", "link": "https://leetcode.com/problems/cells-in-a-range-on-an-excel-sheet/", "date": "1645920000000", "task_description": "A cell `(r, c)` of an excel sheet is represented as a string `\"\"` where: `` denotes the column number `c` of the cell. It is represented by **alphabetical letters**. For example, the `1st` column is denoted by `'A'`, the `2nd` by `'B'`, the `3rd` by `'C'`, and so on. `` is the row number `r` of the cell. The `rth` row is represented by the **integer** `r`. You are given a string `s` in the format `\":\"`, where `` represents the column `c1`, `` represents the row `r1`, `` represents the column `c2`, and `` represents the row `r2`, such that `r1 <= r2` and `c1 <= c2`. Return _the **list of cells**_ `(x, y)` _such that_ `r1 <= x <= r2` _and_ `c1 <= y <= c2`. The cells should be represented as **strings** in the format mentioned above and be sorted in **non-decreasing** order first by columns and then by rows. **Example 1:** ``` **Input:** s = \"K1:L2\" **Output:** [\"K1\",\"K2\",\"L1\",\"L2\"] **Explanation:** The above diagram shows the cells which should be present in the list. The red arrows denote the order in which the cells should be presented. ``` **Example 2:** ``` **Input:** s = \"A1:F1\" **Output:** [\"A1\",\"B1\",\"C1\",\"D1\",\"E1\",\"F1\"] **Explanation:** The above diagram shows the cells which should be present in the list. The red arrow denotes the order in which the cells should be presented. ``` **Constraints:** `s.length == 5` `'A' <= s[0] <= s[3] <= 'Z'` `'1' <= s[1] <= s[4] <= '9'` `s` consists of uppercase English letters, digits and `':'`.", "public_test_cases": [ { "label": "Example 1", "input": "s = \"K1:L2\"", "output": "[\"K1\",\"K2\",\"L1\",\"L2\"] " }, { "label": "Example 2", "input": "s = \"A1:F1\"", "output": "[\"A1\",\"B1\",\"C1\",\"D1\",\"E1\",\"F1\"] " } ], "private_test_cases": [ { "input": "\"C8:D8\"", "output": [ "C8", "D8" ] }, { "input": "\"S9:V9\"", "output": [ "S9", "T9", "U9", "V9" ] }, { "input": "\"Y6:Y9\"", "output": [ "Y6", "Y7", "Y8", "Y9" ] }, { "input": "\"U9:W9\"", "output": [ "U9", "V9", "W9" ] }, { "input": "\"H2:O7\"", "output": [ "H2", "H3", "H4", "H5", "H6", "H7", "I2", "I3", "I4", "I5", "I6", "I7", "J2", "J3", "J4", "J5", "J6", "J7", "K2", "K3", "K4", "K5", "K6", "K7", "L2", "L3", "L4", "L5", "L6", "L7", "M2", "M3", "M4", "M5", "M6", "M7", "N2", "N3", "N4", "N5", "N6", "N7", "O2", "O3", "O4", "O5", "O6", "O7" ] }, { "input": "\"N6:O8\"", "output": [ "N6", "N7", "N8", "O6", "O7", "O8" ] }, { "input": "\"Q1:S8\"", "output": [ "Q1", "Q2", "Q3", "Q4", "Q5", "Q6", "Q7", "Q8", "R1", "R2", "R3", "R4", "R5", "R6", "R7", "R8", "S1", "S2", "S3", "S4", "S5", "S6", "S7", "S8" ] }, { "input": "K9:T9", "output": [ "K9", "L9", "M9", "N9", "O9", "P9", "Q9", "R9", "S9", "T9" ] }, { "input": "W6:W8", "output": [ "W6", "W7", "W8" ] }, { "input": "O5:S8", "output": [ "O5", "O6", "O7", "O8", "P5", "P6", "P7", "P8", "Q5", "Q6", "Q7", "Q8", "R5", "R6", "R7", "R8", "S5", "S6", "S7", "S8" ] } ], "haskell_template": "cellsInRange :: String -> [String]\ncellsInRange s ", "ocaml_template": "let cellsInRange (s: string) : string list = ", "scala_template": "def cellsInRange(s: String): List[String] = { \n \n}", "java_template": "public static List cellsInRange(String s) {\n\n}", "python_template": "class Solution(object):\n def cellsInRange(self, s):\n \"\"\"\n :type s: str\n :rtype: List[str]\n \"\"\"\n " }