question_slug stringlengths 3 77 | title stringlengths 1 183 | slug stringlengths 12 45 | summary stringlengths 1 160 ⌀ | author stringlengths 2 30 | certification stringclasses 2
values | created_at stringdate 2013-10-25 17:32:12 2025-04-12 09:38:24 | updated_at stringdate 2013-10-25 17:32:12 2025-04-12 09:38:24 | hit_count int64 0 10.6M | has_video bool 2
classes | content stringlengths 4 576k | upvotes int64 0 11.5k | downvotes int64 0 358 | tags stringlengths 2 193 | comments int64 0 2.56k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
big-countries | [MySQL] Straight Forward Solution | mysql-straight-forward-solution-by-ravir-11mm | \nselect name, population, area \nfrom World \nwhere (area > 3000000 or population > 25000000);\n | ravireddy07 | NORMAL | 2020-09-17T07:00:41.339301+00:00 | 2020-09-17T07:00:41.339347+00:00 | 263 | false | ```\nselect name, population, area \nfrom World \nwhere (area > 3000000 or population > 25000000);\n``` | 3 | 0 | [] | 0 |
big-countries | My Easy Solution AC | my-easy-solution-ac-by-shtsai7-1wlc | \nSELECT name, population, area\nFROM World\nWHERE area > 3000000 OR population > 25000000;\n | shtsai7 | NORMAL | 2017-08-30T03:00:32.617000+00:00 | 2017-08-30T03:00:32.617000+00:00 | 2,803 | false | ```\nSELECT name, population, area\nFROM World\nWHERE area > 3000000 OR population > 25000000;\n``` | 3 | 0 | [] | 2 |
big-countries | ✅"Easy-way to solve this mysql problem(Step by step)"💯😉 | easy-way-to-solve-this-mysql-problemstep-fsc9 | ApproachWe need to find the countries that are considered "big." A country is big if:It has an area of 3,000,000 square kilometers or more,
It has a population | kabirydv | NORMAL | 2025-03-26T12:17:01.815190+00:00 | 2025-03-26T12:17:01.815190+00:00 | 455 | false |
# Approach
<!-- Describe your approach to solving the problem. -->
# **We need to find the countries that are considered "big." A country is big if:**
**It has an area of 3,000,000 square kilometers or more,**
**It has a population of 25,000,000 people.**
# Code
```mysql []
# Write your MySQL query statement below
S... | 2 | 0 | ['Database', 'MySQL'] | 0 |
big-countries | Разбор решения для русскоязычных программистов | razbor-resheniia-dlia-russkoiazychnykh-p-ahjg | Подход к решению
Используем WHERE с логическим оператором OR, чтобы проверить хотя бы одно из условий:
Возвращаем столбцы name (название страны), population (н | gwynbleidd0241 | NORMAL | 2025-03-10T06:20:46.812085+00:00 | 2025-03-10T06:20:46.812085+00:00 | 261 | false | # Подход к решению
1. Используем WHERE с логическим оператором OR, чтобы проверить хотя бы одно из условий:
```
area >= 3000000
OR population >= 25000000
```
2. Возвращаем столбцы name (название страны), population (население) и area (площадь).
# Сложность
- Временная сложность O(N):
Запрос выполняет проверку для кажд... | 2 | 0 | ['MySQL'] | 0 |
big-countries | Easy Solution in Sequel | easy-solution-in-sequel-by-sathurnithy-40pg | Code | Sathurnithy | NORMAL | 2025-02-26T09:10:07.389037+00:00 | 2025-02-26T09:10:07.389037+00:00 | 439 | false |
# Code
```mysql []
# Write your MySQL query statement below
SELECT name, population, area FROM World WHERE area >= 3000000 OR population >= 25000000;
``` | 2 | 0 | ['Database', 'MySQL'] | 0 |
big-countries | ③ / ⑤⓪ ✅ Fully Explained | Beginner Friendly | Easy Implementation | MSSQL - Pandas | 𝟹/𝟓𝟬 SQL50 | 3-50-fully-explained-beginner-friendly-e-0c40 | IntuitionThe problem requires identifying countries that meet at least one of two conditions: having an area of at least 3 million square kilometers or a popula | _manujain | NORMAL | 2025-02-24T00:30:58.611097+00:00 | 2025-02-24T00:30:58.611097+00:00 | 712 | false | # Intuition
<!-- Describe your first thoughts on how to solve this problem. -->
The problem requires identifying countries that meet at least one of two conditions: having an area of at least 3 million square kilometers or a population of at least 25 million. This calls for a simple filter operation using logical OR to... | 2 | 0 | ['Database', 'MS SQL Server', 'Pandas'] | 0 |
big-countries | EASY SOLUTION · 💡 · 🧠 · 🤔 · 😎👌🔥 · | easy-solution-by-richppl-_-l-r945 | Code | richppl-_-l | NORMAL | 2025-02-12T18:50:47.224661+00:00 | 2025-02-12T18:50:47.224661+00:00 | 392 | false | # Code
```mysql []
SELECT name, population, area
FROM World
WHERE area >= 3000000 OR population >= 25000000;
``` | 2 | 0 | ['MySQL'] | 0 |
big-countries | Easy and Simple Solution | easy-and-simple-solution-by-darwadenidhi-f7sz | IntuitionApproachComplexity
Time complexity:
Space complexity:
Code | darwadenidhi174 | NORMAL | 2025-02-04T11:19:29.830866+00:00 | 2025-02-04T11:19:29.830866+00:00 | 122 | false | # Intuition
<!-- Describe your first thoughts on how to solve this problem. -->
# Approach
<!-- Describe your approach to solving the problem. -->
# Complexity
- Time complexity:
<!-- Add your time complexity here, e.g. $$O(n)$$ -->
- Space complexity:
<!-- Add your space complexity here, e.g. $$O(n)$$ -->
# Code
`... | 2 | 0 | ['MySQL'] | 0 |
big-countries | ezy oneliner MySQL | ezy-oneliner-mysql-by-obstinix-dkb0 | Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time | obstinix | NORMAL | 2024-11-18T12:12:05.320808+00:00 | 2024-11-18T12:12:05.320849+00:00 | 16 | false | # Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ --... | 2 | 0 | ['MySQL'] | 0 |
big-countries | Simple solution using WHERE clause | simple-solution-using-where-clause-by-an-sbof | Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \nUsed WHERE clause to fi | angelin_silviya | NORMAL | 2024-11-11T15:49:38.556782+00:00 | 2024-11-11T15:49:38.556817+00:00 | 800 | false | # Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\nUsed WHERE clause to filer based on area and population\n\n# Code\n```postgresql []\n-- Write your PostgreSQL query statement below\n\nSELECT\nname, population, area\n... | 2 | 0 | ['PostgreSQL'] | 0 |
big-countries | 2 solutions using WHERE, OR and UNION | 2-solutions-using-where-or-and-union-by-r543i | Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time | alexlinus | NORMAL | 2024-10-21T08:47:18.862546+00:00 | 2024-10-21T08:48:45.851983+00:00 | 94 | false | # Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\nO(n) - second one\n - first one I\'m not sure\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- A... | 2 | 0 | ['MySQL', 'PostgreSQL'] | 0 |
big-countries | easy solution | easy-solution-by-sajjan_shivani-k000 | \n# Approach\n Describe your approach to solving the problem. \nSELECT name, population, area: This selects the columns name, population, and area from the Worl | sajjan_shivani | NORMAL | 2024-09-16T13:53:50.285814+00:00 | 2024-09-16T13:53:50.285855+00:00 | 1,938 | false | \n# Approach\n<!-- Describe your approach to solving the problem. -->\nSELECT name, population, area: This selects the columns name, population, and area from the World table.\nFROM World: Specifies that the data is being queried from the World table.\nWHERE area >= 3000000 OR population >= 25000000: The WHERE clause f... | 2 | 0 | ['MySQL'] | 1 |
big-countries | SQL || ✅ Easy Solution || Where Clause | sql-easy-solution-where-clause-by-abhaym-efei | \n\n# Code\n\n# Write your MySQL query statement below\nSELECT name, population,area FROM World where area>=3000000 or population>=25000000;\n | abhaym1205 | NORMAL | 2024-07-30T18:25:35.303885+00:00 | 2024-07-30T18:25:35.303922+00:00 | 823 | false | \n\n# Code\n```\n# Write your MySQL query statement below\nSELECT name, population,area FROM World where area>=3000000 or population>=25000000;\n``` | 2 | 0 | ['MySQL'] | 0 |
big-countries | ✅💯🔥Simple My SQL Code || 🔥✔️Easy to understand🎯 || 🎓🧠Beats 100%🔥|| Beginner friendly💀💯 | simple-my-sql-code-easy-to-understand-be-28o0 | Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time | atishayj4in | NORMAL | 2024-07-22T19:29:28.017160+00:00 | 2024-07-22T19:29:28.017191+00:00 | 1,477 | false | # Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ --... | 2 | 0 | ['MySQL'] | 0 |
big-countries | 3 Parts of an SQL query || Easy explanation | 3-parts-of-an-sql-query-easy-explanation-3flg | \n# Approach\n1. data you want to fetch\n2. table name \n3. conditions\n# Code\n\n# Write your MySQL query statement below\nSELECT name, population, area # Det | kalki299 | NORMAL | 2024-04-02T17:45:14.965328+00:00 | 2024-04-02T17:45:14.965361+00:00 | 191 | false | \n# Approach\n1. data you want to fetch\n2. table name \n3. conditions\n# Code\n```\n# Write your MySQL query statement below\nSELECT name, population, area # Details You want to fetch\nFROM World # From which table\nWHERE (area >= 3000000 OR population >= 25000000) # What are the conditions\n``` | 2 | 0 | ['MySQL'] | 2 |
big-countries | Beginner-friendly solution using MySQL || 1 line approach | beginner-friendly-solution-using-mysql-1-icx0 | Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time | truongtamthanh2004 | NORMAL | 2024-03-07T16:38:34.280175+00:00 | 2024-03-07T16:38:34.280197+00:00 | 3,061 | false | # Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ --... | 2 | 0 | ['MySQL'] | 0 |
big-countries | Easy SQL query for solution 💯💯 | easy-sql-query-for-solution-by-shreyak27-950a | Intuition\nThe solution must contain the name, population and area of the big countries. A country is considered big if the population is at least twenty-five m | shreyak2703 | NORMAL | 2024-03-04T13:03:28.655535+00:00 | 2024-03-04T13:07:45.559304+00:00 | 2,806 | false | # Intuition\nThe solution must contain the name, population and area of the big countries. A country is considered big if the population is at least twenty-five million or the area is at least three million km\xB2.\n\n# Approach\nThe approach to be followed is to filter the countries using the WHERE clause based on the... | 2 | 0 | ['MySQL'] | 0 |
big-countries | EASY 2 QUERY💯|| MYSQL || HAVING/WHERE🔥🔥 | easy-2-query-mysql-havingwhere-by-tanish-5u8x | Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time | tanish-hrk | NORMAL | 2024-01-18T17:35:28.086454+00:00 | 2024-01-18T17:35:28.086482+00:00 | 3,491 | false | # Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ --... | 2 | 0 | ['MySQL'] | 1 |
big-countries | Easy and Understandable SQL Query | easy-and-understandable-sql-query-by-lak-vqu1 | \nSELECT name, population, area\nFROM World\nWHERE area >= 3000000 OR population >= 25000000;\n | lakshmiyadavalli | NORMAL | 2024-01-05T05:36:28.874999+00:00 | 2024-01-05T05:36:28.875026+00:00 | 1,485 | false | ```\nSELECT name, population, area\nFROM World\nWHERE area >= 3000000 OR population >= 25000000;\n``` | 2 | 0 | ['MySQL'] | 1 |
big-countries | Where clause in SQL | where-clause-in-sql-by-k_a_m_o_l-6f45 | Code\n\n/* Write your T-SQL query statement below */\nSELECT name,\n population,\n area \nFROM World \nWHERE area >= 3000000\n OR populatiO | k_a_m_o_l | NORMAL | 2023-11-13T15:07:11.850032+00:00 | 2023-11-13T15:07:11.850059+00:00 | 1,263 | false | # Code\n```\n/* Write your T-SQL query statement below */\nSELECT name,\n population,\n area \nFROM World \nWHERE area >= 3000000\n OR populatiON >= 25000000\n``` | 2 | 0 | ['MS SQL Server'] | 1 |
big-countries | Simple Solution || One Liner || | simple-solution-one-liner-by-yashmenaria-zqcf | Please Upvote\n# Complexity\n- Time complexity: O(1)\n Add your time complexity here, e.g. O(n) \n\n- Space complexity:O(1)\n Add your space complexity here, e. | yashmenaria | NORMAL | 2023-10-06T09:22:11.651809+00:00 | 2023-10-06T09:22:11.651828+00:00 | 3 | false | # Please Upvote\n# Complexity\n- Time complexity: O(1)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:O(1)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\n# Write your MySQL query statement below\n\nSELECT name,population,area FROM WORLD WHERE population >= 25000000... | 2 | 0 | ['MySQL'] | 0 |
big-countries | ✌✔Super Easy Code||MySql | super-easy-codemysql-by-tamosakatwa-q258 | Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time | tamosakatwa | NORMAL | 2023-10-01T17:50:02.549850+00:00 | 2023-10-01T17:50:02.549870+00:00 | 2,738 | false | # Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ --... | 2 | 0 | ['MySQL'] | 0 |
big-countries | 📌 Pandas Beginner Friendly Solution 🚀 | pandas-beginner-friendly-solution-by-pni-oktd | \uD83D\uDD3C IF YOU FIND THIS POST HELPFUL PLEASE UPVOTE \uD83D\uDC4D\n\n\nimport pandas as pd\n\ndef big_countries(world: pd.DataFrame) -> pd.DataFrame:\n f | pniraj657 | NORMAL | 2023-08-09T15:34:47.868712+00:00 | 2023-08-09T15:34:47.868742+00:00 | 774 | false | **\uD83D\uDD3C IF YOU FIND THIS POST HELPFUL PLEASE UPVOTE \uD83D\uDC4D**\n\n```\nimport pandas as pd\n\ndef big_countries(world: pd.DataFrame) -> pd.DataFrame:\n filtered_columns = world[[\'name\', \'area\', \'population\']]\n \n res_df = filtered_columns[(filtered_columns[\'area\'] >= 3000000) | (filtered_co... | 2 | 0 | ['Python'] | 0 |
big-countries | SQL Query Solution | sql-query-solution-by-karthika_subramany-yaxj | Approach\n Describe your approach to solving the problem. \nWe need to select the columns we need from the given table. Later we need to use the where condition | Karthika_Subramanyam | NORMAL | 2023-08-07T17:19:52.108337+00:00 | 2023-08-07T17:20:18.971649+00:00 | 1,835 | false | # Approach\n<!-- Describe your approach to solving the problem. -->\nWe need to select the columns we need from the given table. Later we need to use the where condition to retrive the data we need.\n\n\n\n# Code\n```\n# Write your MySQL query statement below\nselect name, area, population\nfrom world\nwhere area >= 30... | 2 | 0 | ['MySQL'] | 1 |
big-countries | Pandas solution | pandas-solution-by-pttrolley-cclh | Pandas solution: filter by countries with area >= 3000000 or population >= 25000000. Then get the three needed columns. \n\n# Code\n\nimport pandas as pd\n\ndef | pttrolley | NORMAL | 2023-07-19T20:45:06.083270+00:00 | 2023-07-26T18:24:57.724485+00:00 | 862 | false | Pandas solution: filter by countries with area >= 3000000 or population >= 25000000. Then get the three needed columns. \n\n# Code\n```\nimport pandas as pd\n\ndef big_countries(world: pd.DataFrame) -> pd.DataFrame:\n return world[(world[\'area\'] >= 3000000) | (world[\'population\'] >= 25000000)][[\'name\', \'popul... | 2 | 0 | ['Python3', 'Pandas'] | 1 |
big-countries | One Line | one-line-by-ravithemore-g4y7 | \n\n# Write your MySQL query statement below\nSELECT name,population,area FROM World WHERE area>=3000000 OR population>=25000000;\n | ravithemore | NORMAL | 2023-07-19T08:35:50.423829+00:00 | 2023-07-19T08:35:50.423847+00:00 | 1,026 | false | \n```\n# Write your MySQL query statement below\nSELECT name,population,area FROM World WHERE area>=3000000 OR population>=25000000;\n``` | 2 | 0 | ['MySQL'] | 0 |
big-countries | Big Countries 👨🏻💻👨🏻💻 || MySql solution code🔥🔥🔥... | big-countries-mysql-solution-code-by-jay-gbdz | Code\n\n# Write your MySQL query statement below\nselect name, population, area from world where area >= 3000000 or population >=25000000;\n | Jayakumar__S | NORMAL | 2023-07-16T17:24:35.950907+00:00 | 2023-07-16T19:23:50.818216+00:00 | 2,599 | false | # Code\n```\n# Write your MySQL query statement below\nselect name, population, area from world where area >= 3000000 or population >=25000000;\n``` | 2 | 0 | ['MySQL'] | 1 |
big-countries | 96% beats || one line code | 96-beats-one-line-code-by-himakshikohli-spby | \n# Code\n\n# Write your MySQL query statement below\nselect name, population, area from World where area>=3000000 union select name, population, area from Worl | himakshikohli | NORMAL | 2023-07-15T04:32:56.108171+00:00 | 2023-07-15T04:32:56.108201+00:00 | 1,334 | false | \n# Code\n```\n# Write your MySQL query statement below\nselect name, population, area from World where area>=3000000 union select name, population, area from World where population>=25000000\n``` | 2 | 0 | ['MySQL'] | 3 |
determine-color-of-a-chessboard-square | C++ One-Liner | c-one-liner-by-votrubac-3hv3 | cpp\nbool squareIsWhite(string c) {\n return (c[0] + c[1]) % 2;\n}\n | votrubac | NORMAL | 2021-04-03T17:31:19.511431+00:00 | 2021-04-03T17:32:06.960284+00:00 | 4,725 | false | ```cpp\nbool squareIsWhite(string c) {\n return (c[0] + c[1]) % 2;\n}\n``` | 116 | 2 | [] | 14 |
determine-color-of-a-chessboard-square | [Java/C++/Python] 1-lines | javacpython-1-lines-by-lee215-amgx | Time O(1)\nSpace O(1)\n\n\nJava\njava\n public boolean squareIsWhite(String a) {\n return a.charAt(0) % 2 != a.charAt(1) % 2; \n }\n\n\nC++\ncpp\n | lee215 | NORMAL | 2021-04-03T16:11:29.566081+00:00 | 2021-10-26T08:19:23.646919+00:00 | 5,826 | false | Time `O(1)`\nSpace `O(1)`\n<br>\n\n**Java**\n```java\n public boolean squareIsWhite(String a) {\n return a.charAt(0) % 2 != a.charAt(1) % 2; \n }\n```\n\n**C++**\n```cpp\n bool squareIsWhite(string a) {\n return a[0] % 2 != a[1] % 2;\n }\n```\n\n**Python**\n```py\n def squareIsWhite(self, ... | 61 | 6 | [] | 12 |
determine-color-of-a-chessboard-square | Java Simple and easy to understand solution, 0 ms, faster than 100.00% , clean code with comments | java-simple-and-easy-to-understand-solut-h06a | PLEASE UPVOTE IF YOU LIKE THIS SOLUTION\n\n\nclass Solution {\n public boolean squareIsWhite(String coordinates) {\n char letter = coordinates.charAt( | satyaDcoder | NORMAL | 2021-04-03T17:21:00.847428+00:00 | 2021-04-03T17:21:00.847457+00:00 | 1,643 | false | **PLEASE UPVOTE IF YOU LIKE THIS SOLUTION**\n\n```\nclass Solution {\n public boolean squareIsWhite(String coordinates) {\n char letter = coordinates.charAt(0);\n int digit = coordinates.charAt(1) - \'0\';\n \n \n if(letter == \'a\' || letter == \'c\' || letter == \'e\' || letter =... | 23 | 1 | ['Java'] | 3 |
determine-color-of-a-chessboard-square | JAVA || C++ || Python3 || SELF EXPLANATORY|| FASTER THAN 100% | java-c-python3-self-explanatory-faster-t-r9b1 | C++\nRuntime: 0 ms, faster than 100.00% of C++\n\nclass Solution {\npublic:\n bool squareIsWhite(string coordinates) {\n return (coordinates[0] - \'a\ | rajat_gupta_ | NORMAL | 2021-04-03T16:11:19.660307+00:00 | 2021-04-03T16:17:40.124196+00:00 | 1,338 | false | # C++\n**Runtime: 0 ms, faster than 100.00% of C++**\n```\nclass Solution {\npublic:\n bool squareIsWhite(string coordinates) {\n return (coordinates[0] - \'a\' + coordinates[1] - \'1\') % 2;\n }\n};\n```\n# JAVA\n**Runtime: 0 ms, faster than 100.00% of Java**\n```\nclass Solution {\n public boolean squ... | 18 | 3 | ['C', 'Java'] | 1 |
determine-color-of-a-chessboard-square | [Java/Python 3] One liner O(1) code: odd / even analysis . | javapython-3-one-liner-o1-code-odd-even-qj3ol | Calculate the sum of row and column coordinates, check if it is even; If yes return true; otherwise, return false.\njava\n public boolean squareIsWhite(Strin | rock | NORMAL | 2021-04-03T16:03:17.079769+00:00 | 2021-05-14T17:20:28.335993+00:00 | 1,464 | false | Calculate the sum of row and column coordinates, check if it is even; If yes return `true`; otherwise, return `false`.\n```java\n public boolean squareIsWhite(String c) {\n return (c.charAt(0) - \'a\' + c.charAt(1) - \'0\' ) % 2 == 0;\n }\n```\n```python\n def squareIsWhite(self, coordinates: str) -> bo... | 17 | 0 | [] | 3 |
determine-color-of-a-chessboard-square | [Python/Python3 | Simple and Easy code | self-explanatory | pythonpython3-simple-and-easy-code-self-yajp8 | Note:- If you have any doubt, Free to ask me, Please Upvote if you like it.\n\nclass Solution:\n def squareIsWhite(self, c: str) -> bool:\n if c[0] in | sukhdev_143 | NORMAL | 2021-04-03T19:43:49.413091+00:00 | 2021-04-03T19:56:53.721804+00:00 | 1,533 | false | Note:- _If you have any doubt, Free to ask me, Please **Upvote** if you like it._\n```\nclass Solution:\n def squareIsWhite(self, c: str) -> bool:\n if c[0] in \'aceg\':\n return int(c[1])%2==0\n elif c[0] in \'bdfh\':\n return int(c[1])%2==1\n return False\n``` | 16 | 2 | ['Python', 'Python3'] | 2 |
determine-color-of-a-chessboard-square | Python faster than 99.67% | python-faster-than-9967-by-macaquedev-p70y | \nclass Solution:\n def squareIsWhite(self, coordinates: str) -> bool:\n if coordinates[0] in "aceg":\n return coordinates[1] in "2468"\n | macaquedev | NORMAL | 2021-04-08T14:31:29.693746+00:00 | 2021-04-08T14:31:29.693777+00:00 | 955 | false | ```\nclass Solution:\n def squareIsWhite(self, coordinates: str) -> bool:\n if coordinates[0] in "aceg":\n return coordinates[1] in "2468"\n else:\n return coordinates[1] in "1357"\n``` | 14 | 0 | [] | 4 |
determine-color-of-a-chessboard-square | Excellent solution explained in detail | excellent-solution-explained-in-detail-b-fps4 | Intuition\n- The condition of standing on a white chess square is that the sum of the columns and rows must be odd. \n- We have row value given as integer but c | Najmiddin1 | NORMAL | 2022-12-11T12:06:06.765333+00:00 | 2022-12-11T12:06:06.765371+00:00 | 716 | false | # Intuition\n- The condition of standing on a white chess square is that the sum of the columns and rows must be odd. \n- We have row value given as integer but column value given as letter. \n- We need to use the `ascii` table to get the value of the string. In the `ascii` table, the value of a lowercase letter starts... | 10 | 0 | ['Python3'] | 1 |
determine-color-of-a-chessboard-square | Python solution with slice | python-solution-with-slice-by-it_bilim-87ag | \nclass Solution(object):\n def squareIsWhite(self, c):\n a,b=ord(c[0])-96,int(c[1])\n if a%2==b%2:\n return False\n return T | it_bilim | NORMAL | 2021-04-03T16:07:16.210278+00:00 | 2021-04-03T16:07:16.210302+00:00 | 487 | false | ```\nclass Solution(object):\n def squareIsWhite(self, c):\n a,b=ord(c[0])-96,int(c[1])\n if a%2==b%2:\n return False\n return True\n``` | 10 | 4 | [] | 1 |
determine-color-of-a-chessboard-square | c++ || Easy one liner | c-easy-one-liner-by-suman_cp-l5ob | \n\nreturn !((s[0]-\'a\'+s[1]-\'0\')&1);\n | suman_cp | NORMAL | 2021-04-03T16:02:12.202434+00:00 | 2021-04-03T16:02:12.202479+00:00 | 538 | false | \n```\nreturn !((s[0]-\'a\'+s[1]-\'0\')&1);\n``` | 8 | 2 | [] | 3 |
determine-color-of-a-chessboard-square | 🔥Don't fear with this fire Solution🔥100% beats 0 ms | one-line-solution-beats-100-runtime-and-gdlyb | IntuitionApproachComplexity
Time complexity:O(1)
Space complexity:O(1)
Code | Ija_z_03 | NORMAL | 2025-01-24T06:09:27.416961+00:00 | 2025-01-24T06:26:32.251054+00:00 | 330 | false | # Intuition
<!-- Describe your first thoughts on how to solve this problem. -->
# Approach
<!-- Describe your approach to solving the problem. -->
# Complexity
- Time complexity:O(1)
<!-- Add your time complexity here, e.g. $$O(n)$$ -->
- Space complexity:O(1)
<!-- Add your space complexity here, e.g. $$O(n)$$ -->
... | 7 | 0 | ['Java'] | 6 |
determine-color-of-a-chessboard-square | JavaScript O(1) Solution (1-line) w/ Explanation | javascript-o1-solution-1-line-w-explanat-6744 | \n/**\n * @param {string} coordinates\n * @return {boolean}\n */\nconst squareIsWhite = (coordinates) => {\n return coordinates[0].charCodeAt(0) % 2 !== pars | ahhreggi | NORMAL | 2021-04-13T01:46:31.284943+00:00 | 2021-04-13T01:46:31.284977+00:00 | 801 | false | ```\n/**\n * @param {string} coordinates\n * @return {boolean}\n */\nconst squareIsWhite = (coordinates) => {\n return coordinates[0].charCodeAt(0) % 2 !== parseInt(coordinates[1]) % 2;\n}\n```\n\nExplanation:\n\nThe "eveness" or "oddness" of a letter or number in the coordinate is represented by 0 (even) or 1 (odd)... | 7 | 0 | ['JavaScript'] | 2 |
determine-color-of-a-chessboard-square | JavaScript Solution (With Illustration) | javascript-solution-with-illustration-by-qoj9 | \n\n\n\nconst squareIsWhite = (s) => s.charCodeAt(0) % 2 !== s.charCodeAt(1) % 2;\n | rinatrezyapov | NORMAL | 2022-07-07T06:31:36.803273+00:00 | 2022-07-18T06:39:19.633333+00:00 | 452 | false | \n\n\n```\nconst squareIsWhite = (s) => s.charCodeAt(0) % 2 !== s.charCodeAt(1) % 2;\n``` | 6 | 0 | ['JavaScript'] | 0 |
determine-color-of-a-chessboard-square | C++ solution ||100% faster | c-solution-100-faster-by-anubhavbaner7-mqvn | \n bool squareIsWhite(string coordinates) {\n int x=(int)(coordinates[0]-\'a\');\n int y=(int)(coordinates[1]-\'0\');\n if((x%2==0&&y%2==0) | anubhavbaner7 | NORMAL | 2021-04-14T12:31:58.974492+00:00 | 2021-04-14T12:31:58.974524+00:00 | 797 | false | ```\n bool squareIsWhite(string coordinates) {\n int x=(int)(coordinates[0]-\'a\');\n int y=(int)(coordinates[1]-\'0\');\n if((x%2==0&&y%2==0)||(x%2!=0&&y%2!=0))\n return true;\n else\n return false;\n }\n``` | 6 | 0 | ['C', 'C++'] | 1 |
determine-color-of-a-chessboard-square | Python O(1) Space and Time | python-o1-space-and-time-by-selmand42-jpxh | \n# Code\n\nclass Solution:\n def squareIsWhite(self, coordinates: str) -> bool:\n\n return 1 & (ord(coordinates[0]) + int(coordinates[1]))\n | Selmand42 | NORMAL | 2023-02-15T12:08:44.456650+00:00 | 2023-03-28T11:44:19.587923+00:00 | 736 | false | \n# Code\n```\nclass Solution:\n def squareIsWhite(self, coordinates: str) -> bool:\n\n return 1 & (ord(coordinates[0]) + int(coordinates[1]))\n``` | 5 | 0 | ['Python', 'Python3'] | 2 |
determine-color-of-a-chessboard-square | Easy C++ solution, 100% faster than other users 0ms O(1) | easy-c-solution-100-faster-than-other-us-lrkm | if row is odd and column is odd then we get a black else white\nif row is even but column is odd then we get a white else black\n\nclass Solution {\npublic:\n | zeus-salazar | NORMAL | 2022-06-22T11:43:48.227433+00:00 | 2022-06-22T11:43:48.227484+00:00 | 179 | false | if row is odd and column is odd then we get a black else white\nif row is even but column is odd then we get a white else black\n```\nclass Solution {\npublic:\n bool squareIsWhite(string coordinates) {\n if ((coordinates[1]-\'0\')%2){\n if ((coordinates[0]-\'a\'+1)%2){\n return fals... | 5 | 0 | [] | 0 |
determine-color-of-a-chessboard-square | Python easy | python-easy-by-sathish_mccall-gojp | Just take out the alphabet and calculate ord value and find out int value, if sum is even return false , else True\n\n\nclass Solution:\n def squareIsWhite(s | Sathish_McCall | NORMAL | 2022-06-22T11:31:18.754202+00:00 | 2022-06-22T11:31:18.754242+00:00 | 251 | false | Just take out the alphabet and calculate ord value and find out int value, if sum is even return false , else True\n\n```\nclass Solution:\n def squareIsWhite(self, c: str) -> bool:\n s1=ord(c[0])-96\n s2=int(c[1])\n if (s1+s2)%2==0:\n return False\n return True\n``` | 5 | 0 | [] | 0 |
determine-color-of-a-chessboard-square | C | Tiny 0ms beats 100% | c-tiny-0ms-beats-100-by-iosdevzone-0z8g | c\nbool squareIsWhite(char * coordinates){\n return (coordinates[0] + coordinates[1]) & 1;\n}\n\n\nThis probably deserves a little explanation:\n\nA square i | iosdevzone | NORMAL | 2021-09-13T06:53:42.745859+00:00 | 2021-09-13T06:54:16.281567+00:00 | 213 | false | ```c\nbool squareIsWhite(char * coordinates){\n return (coordinates[0] + coordinates[1]) & 1;\n}\n```\n\nThis probably deserves a little explanation:\n\nA square is white if `coordinates[0] - \'a\' + coordinates[1] - \'1\' % 2 == 1`\nbut `\'a\' + \'1\' % 2 == 0` so we can remove this.\n\nThat leaves us with `coordi... | 5 | 0 | ['C'] | 0 |
determine-color-of-a-chessboard-square | [Java] 0ms 100% fast and easy to understand solution | java-0ms-100-fast-and-easy-to-understand-9oul | \npublic boolean squareIsWhite(String coordinates) {\n int xCoordinate = coordinates.charAt(0) - \'a\' + 1; \n\t\t// Convert first coordinate into a numb | shankur09 | NORMAL | 2021-07-15T18:14:12.882954+00:00 | 2021-07-16T06:38:37.767803+00:00 | 460 | false | ```\npublic boolean squareIsWhite(String coordinates) {\n int xCoordinate = coordinates.charAt(0) - \'a\' + 1; \n\t\t// Convert first coordinate into a number similar to Y axis\n int yCoordinate = coordinates.charAt(1);\n return (xCoordinate + yCoordinate) % 2 != 0; \n // For White Squares s... | 5 | 0 | ['Java'] | 0 |
determine-color-of-a-chessboard-square | A simple one liner with runtime of only 30 ms and easy to understand (I think so !). | a-simple-one-liner-with-runtime-of-only-3goyt | Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time | ahsankhalid859 | NORMAL | 2023-11-02T01:55:48.197624+00:00 | 2023-11-02T01:55:48.197653+00:00 | 318 | false | # Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ --... | 4 | 0 | ['Python3'] | 1 |
determine-color-of-a-chessboard-square | 1812. is one line solution | 1812-is-one-line-solution-by-1exsus-n9rd | Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time | 1exSus | NORMAL | 2023-02-13T11:14:50.939458+00:00 | 2023-02-13T11:14:50.939509+00:00 | 281 | false | # Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ --... | 4 | 0 | ['JavaScript'] | 1 |
determine-color-of-a-chessboard-square | ✅ JAVA ✅ Faster --> one line | java-faster-one-line-by-bgautam1254-3ead | return coordinates.charAt(0) % 2 != coordinates.charAt(1) % 2;\n\nexplanation\nif c[0]==even && c[1]==even && c[0]==odd && c[1]==odd--> false\nif c[0]==even && | bgautam1254 | NORMAL | 2022-10-04T16:13:15.460457+00:00 | 2022-10-04T16:17:54.994112+00:00 | 368 | false | **`return coordinates.charAt(0) % 2 != coordinates.charAt(1) % 2;`**\n\n**explanation**\n**if c[0]==even && c[1]==even && c[0]==odd && c[1]==odd--> false\nif c[0]==even && c[1]==odd && c[0]==odd && c[1]==even--> true**\n` `\n**If you have any question, feel free to ask. If you like the solution or the explanation, Plea... | 4 | 0 | ['Java'] | 1 |
determine-color-of-a-chessboard-square | Go that beats 100% | go-that-beats-100-by-tuanbieber-f0h7 | \nfunc squareIsWhite(c string) bool {\n s := fmt.Sprintf("%c", c[0])\n r, _ := strconv.Atoi(fmt.Sprintf("%c", c[1]))\n \n if s == "a" || s == "c" || | tuanbieber | NORMAL | 2022-06-21T06:20:25.624453+00:00 | 2022-06-21T06:20:25.624491+00:00 | 182 | false | ```\nfunc squareIsWhite(c string) bool {\n s := fmt.Sprintf("%c", c[0])\n r, _ := strconv.Atoi(fmt.Sprintf("%c", c[1]))\n \n if s == "a" || s == "c" || s == "e" || s == "g" {\n if r % 2 == 0 {\n return true\n }\n } else {\n if r % 2 == 1 {\n return true\n ... | 4 | 0 | ['Go'] | 1 |
determine-color-of-a-chessboard-square | One line Solution using Bitwise AND(&). | one-line-solution-using-bitwise-and-by-m-k4gv | we know that ASCCII value if \'a\' is 97 which is odd. so \'b\' is even, \'c\' is odd and so on.\nwe can easily absorve that coordinates(odd, odd) is black and | mdcse | NORMAL | 2022-01-15T13:46:14.586666+00:00 | 2022-01-15T13:46:14.586707+00:00 | 32 | false | we know that ASCCII value if \'a\' is 97 which is odd. so \'b\' is even, \'c\' is odd and so on.\nwe can easily absorve that coordinates(odd, odd) is black and coordinates(even, even) is black,\nwhere we have to return false; and other wise true;\n(odd+odd)&1==0 and (even+even)&1==0; \nso we can simply " return ((coord... | 4 | 0 | [] | 0 |
determine-color-of-a-chessboard-square | Easy Javascript solution 1-line | easy-javascript-solution-1-line-by-saynn-8w7p | \n/**\n * @param {string} coordinates\n * @return {boolean}\n */\nvar squareIsWhite = function(coordinates) {\n return "aceg".includes(coordinates[0]) ? coor | saynn | NORMAL | 2021-04-26T19:44:35.551063+00:00 | 2021-04-26T19:44:35.551095+00:00 | 228 | false | ```\n/**\n * @param {string} coordinates\n * @return {boolean}\n */\nvar squareIsWhite = function(coordinates) {\n return "aceg".includes(coordinates[0]) ? coordinates[1] % 2 === 0 : coordinates[1] % 2 === 1\n};\n``` | 4 | 0 | ['JavaScript'] | 0 |
determine-color-of-a-chessboard-square | Rust one-liner | rust-one-liner-by-dnnx-6v2u | \nimpl Solution {\n pub fn square_is_white(coordinates: String) -> bool {\n coordinates.as_bytes().iter().sum::<u8>() % 2 == 1\n }\n}\n | dnnx | NORMAL | 2021-04-09T19:21:29.577432+00:00 | 2021-04-09T19:21:29.577475+00:00 | 59 | false | ```\nimpl Solution {\n pub fn square_is_white(coordinates: String) -> bool {\n coordinates.as_bytes().iter().sum::<u8>() % 2 == 1\n }\n}\n``` | 4 | 0 | [] | 0 |
determine-color-of-a-chessboard-square | Python 3, one liner | python-3-one-liner-by-silvia42-zu2m | We can "rename" the coordinates a->1, b->2, ..., h->8.\nIt is easier to investigate numbers.\nWe can see:\nBLACK: both coordinates are even OR both coordinates | silvia42 | NORMAL | 2021-04-03T16:01:35.573515+00:00 | 2021-04-03T16:51:58.446783+00:00 | 219 | false | We can "rename" the coordinates ```a->1, b->2, ..., h->8```.\nIt is easier to investigate numbers.\nWe can see:\nBLACK: **both** coordinates are **even** OR **both** coordinates are **odd**\nWHITE: one coordinate is even and one is odd\n\n```\nclass Solution:\n def squareIsWhite(self, coordinates: str) -> bool:\n ... | 4 | 0 | [] | 0 |
determine-color-of-a-chessboard-square | 🔥FIRE SOLUTION WITH 100% BEATS🔥 | fire-solution-with-100-beats-by-chathur_-bct0 | null | Chathur_0920 | NORMAL | 2025-01-24T06:20:34.122001+00:00 | 2025-01-24T06:20:34.122001+00:00 | 128 | false |
```java []
class Solution {
public boolean squareIsWhite(String s) {
return ((s.charAt(0) - 'a' + 1) % 2) != ((s.charAt(1) - '0') % 2);
}
// odd odd -> false
// odd even white true
// even even false
// even odd true
}
``` | 3 | 0 | ['Java'] | 3 |
determine-color-of-a-chessboard-square | one line code....just return only...100% beats....0 ms | one-line-codejust-return-only100-beats0-99fvt | IntuitionApproachComplexity
Time complexity:
Space complexity:
Code | Sorna_Prabhakaran | NORMAL | 2024-12-24T06:27:03.066617+00:00 | 2024-12-24T06:27:03.066617+00:00 | 224 | false | # Intuition
<!-- Describe your first thoughts on how to solve this problem. -->
# Approach
<!-- Describe your approach to solving the problem. -->
# Complexity
- Time complexity:
<!-- Add your time complexity here, e.g. $$O(n)$$ -->
- Space complexity:
<!-- Add your space complexity here, e.g. $$O(n)$$ -->
# Code
`... | 3 | 0 | ['Java'] | 0 |
determine-color-of-a-chessboard-square | 100 % BEATS C++ 🔥 | 100-beats-c-by-saajidahamed-pnxj | Intuition\n\n\n# Approach\n\n\n# Complexity\n- Time complexity:\nO(1)\n\n- Space complexity:\nO(1)\n\n# Code\ncpp []\nclass Solution {\npublic:\n bool square | SaajidAhamed | NORMAL | 2024-11-09T05:10:10.639538+00:00 | 2024-11-09T05:10:10.639573+00:00 | 107 | false | # Intuition\n\n\n# Approach\n\n\n# Complexity\n- Time complexity:\nO(1)\n\n- Space complexity:\nO(1)\n\n# Code\n```cpp []\nclass Solution {\npublic:\n bool squareIsWhite(string coordinates) {\n if(((coordinates[0]-\'a\')%2==0 && coordinates[1]%2==0) || ((coordinates[0]-\'a\')%2!=0 && coordinates[1]%2!=0)){\n ... | 3 | 0 | ['C++'] | 2 |
determine-color-of-a-chessboard-square | Java one line code 100% faster 💯| Easiest explanation✅ || Beginner Friendly🔥🔥🔥 | java-one-line-code-100-faster-easiest-ex-uzui | Intuition\n Describe your first thoughts on how to solve this problem. \nTo solve this problem, we need to determine the color of a chessboard square based on g | shanmukh_vasupalli | NORMAL | 2024-08-01T12:49:22.585546+00:00 | 2024-08-01T12:49:22.585585+00:00 | 170 | false | # Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nTo solve this problem, we need to determine the color of a chessboard square based on given coordinates. The coordinates are provided as a string, where the first character represents the column (\'a\' to \'h\') and the second character r... | 3 | 0 | ['Java'] | 0 |
determine-color-of-a-chessboard-square | Solution with bitwise operations | solution-with-bitwise-operations-by-cozy-ylxx | Summary\nThis solution determines whether a given chessboard square is white or black by directly applying bitwise operations on the ASCII values of the coordin | cozyTsuko | NORMAL | 2024-04-25T20:39:53.865744+00:00 | 2024-04-25T20:39:53.865768+00:00 | 57 | false | # Summary\nThis solution determines whether a given chessboard square is white or black by directly applying bitwise operations on the ASCII values of the coordinates.\n# Idea\nWe can exploit the properties of ASCII values to determine whether a square is white or black.\n**White** squares are those with **odd** sums o... | 3 | 0 | ['C'] | 0 |
determine-color-of-a-chessboard-square | Python || 3 Lines || Eazy to understand beat 98% 🚀 | python-3-lines-eazy-to-understand-beat-9-acqo | Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time | Ali-Aljufairi | NORMAL | 2023-11-26T13:55:47.087674+00:00 | 2023-11-26T13:55:47.087703+00:00 | 262 | false | # Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ --... | 3 | 0 | ['Python3'] | 1 |
determine-color-of-a-chessboard-square | ✔Simple and Easy to understand ✌ | simple-and-easy-to-understand-by-kraken_-bdkh | \n\n# Code\n\nclass Solution {\npublic:\n bool squareIsWhite(string coordinates) {\n if((coordinates[0]==\'a\'||coordinates[0]==\'c\'||coordinates[0]= | Kraken_02 | NORMAL | 2023-02-14T05:06:02.509977+00:00 | 2023-02-14T05:06:02.510031+00:00 | 535 | false | \n\n# Code\n```\nclass Solution {\npublic:\n bool squareIsWhite(string coordinates) {\n if((coordinates[0]==\'a\'||coordinates[0]==\'c\'||coordinates[0]==\'e\'||coordinates[0]==\'g\') && coordinates[1]%2!=0){\n return false;\n }else if((coordinates[0]==\'b\'||coordinates[0]==\'d\'||coordinat... | 3 | 0 | ['C++'] | 0 |
determine-color-of-a-chessboard-square | Easy python Solution || 4lines sol beats 92% | easy-python-solution-4lines-sol-beats-92-vlr9 | \n# Code\n\nclass Solution(object):\n def squareIsWhite(self, coordinates):\n """\n :type coordinates: str\n :rtype: bool\n """\n | Lalithkiran | NORMAL | 2023-02-12T14:51:31.974972+00:00 | 2023-02-12T14:51:31.974999+00:00 | 494 | false | \n# Code\n```\nclass Solution(object):\n def squareIsWhite(self, coordinates):\n """\n :type coordinates: str\n :rtype: bool\n """\n s="aceg"\n if coordinates[0] in s:\n return int(coordinates[1])%2==0\n return int(coordinates[1])%2!=0\n``` | 3 | 0 | ['Python'] | 0 |
determine-color-of-a-chessboard-square | c++ | 100% faster than all | easy | c-100-faster-than-all-easy-by-venomhighs-1fc3 | \n\n# Code\n\n\n class Solution {\npublic:\n bool squareIsWhite(string coordinates) {\n int c = coordinates[0] - 96 + coordinates[1] - \'0\';\n | venomhighs7 | NORMAL | 2022-11-15T04:05:25.364221+00:00 | 2022-11-15T04:05:25.364288+00:00 | 344 | false | \n\n# Code\n```\n\n class Solution {\npublic:\n bool squareIsWhite(string coordinates) {\n int c = coordinates[0] - 96 + coordinates[1] - \'0\';\n return c & 1;\n }\n\n};\n``` | 3 | 1 | ['C++'] | 0 |
determine-color-of-a-chessboard-square | Easy C++ Solution || beats 100% || 0ms solution | easy-c-solution-beats-100-0ms-solution-b-ew38 | Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time | umangrathi110 | NORMAL | 2022-10-18T17:39:58.988265+00:00 | 2022-10-18T17:39:58.988316+00:00 | 388 | false | # Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity: O(1)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: O(1)\n<!-- Add your space complexity here, e.g. $... | 3 | 0 | ['C++'] | 1 |
determine-color-of-a-chessboard-square | 1812. Simple C++ solution || 100% faster solution | 1812-simple-c-solution-100-faster-soluti-is2j | \nclass Solution {\npublic:\n bool squareIsWhite(string s) {\n \n if((s[0]+s[1])%2==0)\n return false;\n else\n return | shreyash_153 | NORMAL | 2022-10-14T11:20:01.038334+00:00 | 2023-01-28T18:33:08.123323+00:00 | 843 | false | ```\nclass Solution {\npublic:\n bool squareIsWhite(string s) {\n \n if((s[0]+s[1])%2==0)\n return false;\n else\n return true;\n }\n};\n``` | 3 | 0 | ['Math', 'String', 'C'] | 0 |
determine-color-of-a-chessboard-square | ✅Runtime: 0 ms, faster than 100.00% of C++ online submissions | runtime-0-ms-faster-than-10000-of-c-onli-xwge | \n/*** 1812. Determine Color of a Chessboard Square ***/\n\nclass Solution {\npublic:\n bool squareIsWhite(string coordinates) {\n bool ans = false;\n | Adarsh_Shukla | NORMAL | 2022-09-05T14:36:15.113122+00:00 | 2022-09-05T14:36:15.113161+00:00 | 209 | false | ```\n/*** 1812. Determine Color of a Chessboard Square ***/\n\nclass Solution {\npublic:\n bool squareIsWhite(string coordinates) {\n bool ans = false;\n if(coordinates[0]==\'a\' || coordinates[0]==\'c\' || coordinates[0]==\'e\' || coordinates[0]==\'g\'){\n if(coordinates[1]%2==0) ans=true;\... | 3 | 0 | ['String', 'C'] | 0 |
determine-color-of-a-chessboard-square | [C++] Simple one-line Xor solution | c-simple-one-line-xor-solution-by-yousse-lyxi | \n bool squareIsWhite(string coordinates) {\n return (coordinates[1] ^ coordinates[0]) & 1;\n }\n\nIf we simplify the problem and just look at the | yousseftarekt | NORMAL | 2022-07-06T12:08:56.871704+00:00 | 2022-07-06T12:08:56.871744+00:00 | 65 | false | ```\n bool squareIsWhite(string coordinates) {\n return (coordinates[1] ^ coordinates[0]) & 1;\n }\n```\nIf we simplify the problem and just look at the small 2x2 square of [a1, a2, b1, b2] you can easily notice how it\'s a perfect Xor grid, and luckily because of how the ascii numbers for both characters ... | 3 | 0 | ['Bit Manipulation', 'C'] | 0 |
determine-color-of-a-chessboard-square | JAVA 100% FASTER SOLUTION 🏆 | java-100-faster-solution-by-sulaymon-dev-y0tp | SHAH, your march my dear \u265F\n\n\nclass Solution {\n public boolean squareIsWhite(String coordinates) {\n int x = 98 - (int) coordinates.charAt(0); | Sulaymon-Dev20 | NORMAL | 2022-06-23T21:44:13.289059+00:00 | 2022-06-23T21:44:13.289092+00:00 | 216 | false | ``SHAH, your march my dear \u265F ``\n\n```\nclass Solution {\n public boolean squareIsWhite(String coordinates) {\n int x = 98 - (int) coordinates.charAt(0); // ascii table a=98\n int y = (int) coordinates.charAt(1) - \'0\';\n x = y % 2 == 0 ? x + 1 : x;\n return ((y * 8) + x) % 2 == 0;\... | 3 | 0 | ['Java'] | 0 |
determine-color-of-a-chessboard-square | C++ RUNTIME 0ms | c-runtime-0ms-by-ajaysanthoshb-hbua | \nclass Solution {\npublic:\n bool squareIsWhite(string coordinates) {\n // if rows are odd then starts with black\n // here even col is black\ | ajaysanthoshb | NORMAL | 2022-06-22T11:43:10.286043+00:00 | 2022-06-22T11:43:10.286088+00:00 | 95 | false | ```\nclass Solution {\npublic:\n bool squareIsWhite(string coordinates) {\n // if rows are odd then starts with black\n // here even col is black\n if(int(coordinates[1]) % 2 != 0)\n {\n if((coordinates[0]-\'a\')%2 == 0)\n {\n return false;\n ... | 3 | 0 | [] | 0 |
determine-color-of-a-chessboard-square | Easy C++ solution || One line | easy-c-solution-one-line-by-saiteja_ball-7hge | \nclass Solution {\npublic:\n bool squareIsWhite(string coordinates) {\n //if the sum of row number and col number is odd then the \n //square | saiteja_balla0413 | NORMAL | 2021-06-08T14:55:13.841376+00:00 | 2021-06-08T14:55:13.841421+00:00 | 214 | false | ```\nclass Solution {\npublic:\n bool squareIsWhite(string coordinates) {\n //if the sum of row number and col number is odd then the \n //square color is white\n return ((coordinates[0]-\'a\'+1+coordinates[1]-\'0\')%2);\n }\n};\n```\n**please upvote if this helps you :)** | 3 | 0 | ['C'] | 0 |
determine-color-of-a-chessboard-square | 100% faster 0 ms - Simple Java Solution | 100-faster-0-ms-simple-java-solution-by-krtjr | \nclass Solution {\n public boolean squareIsWhite(String coordinates) {\n char first = coordinates.charAt(0);\n char second = coordinates.charAt(1) | Nitesh_09 | NORMAL | 2021-04-12T15:48:47.407677+00:00 | 2021-04-12T15:48:47.407703+00:00 | 171 | false | ```\nclass Solution {\n public boolean squareIsWhite(String coordinates) {\n char first = coordinates.charAt(0);\n char second = coordinates.charAt(1);\n int num = second-\'0\';\n if(first==\'a\' || first==\'c\'|| first==\'e\' || first==\'g\')\n {\n return num%2==0;\n }\n ... | 3 | 0 | [] | 0 |
determine-color-of-a-chessboard-square | Swift - One Liner or Bit | swift-one-liner-or-bit-by-h_crane-5t3r | swift\n\n1. One Liner \n\n\nfunc squareIsWhite(_ coordinates: String) -> Bool {\n\treturn coordinates.map(\\.unicodeScalars.first!.value).reduce(0, +) % 2 != 0 | h_crane | NORMAL | 2021-04-10T13:54:49.847421+00:00 | 2021-04-10T14:04:45.347759+00:00 | 108 | false | swift\n\n1. One Liner \n\n```\nfunc squareIsWhite(_ coordinates: String) -> Bool {\n\treturn coordinates.map(\\.unicodeScalars.first!.value).reduce(0, +) % 2 != 0\n}\n```\n\n2. Bit\n\n```\nfunc squareIsWhite(_ coordinates: String) -> Bool {\n\tvar num: UInt32 = 0\n\n\tcoordinates.forEach {\n\t\tif let i = UInt32(Strin... | 3 | 0 | ['Swift'] | 0 |
determine-color-of-a-chessboard-square | Golang one-liner using bitwise operations | golang-one-liner-using-bitwise-operation-4muc | \nfunc squareIsWhite(coordinates string) bool {\n return 0 != ((coordinates[0] ^ coordinates[1]) & 1)\n}\n | vashik | NORMAL | 2021-04-05T22:21:00.794611+00:00 | 2021-04-05T22:21:00.794649+00:00 | 101 | false | ```\nfunc squareIsWhite(coordinates string) bool {\n return 0 != ((coordinates[0] ^ coordinates[1]) & 1)\n}\n``` | 3 | 0 | ['Go'] | 0 |
determine-color-of-a-chessboard-square | C# Solution | c-solution-by-mhorskaya-kew3 | \npublic bool SquareIsWhite(string c)\n\t=> (c[0] + c[1] - \'a\' - \'1\') % 2 == 1;\n | mhorskaya | NORMAL | 2021-04-05T14:45:36.995377+00:00 | 2021-04-05T14:45:36.995422+00:00 | 146 | false | ```\npublic bool SquareIsWhite(string c)\n\t=> (c[0] + c[1] - \'a\' - \'1\') % 2 == 1;\n``` | 3 | 0 | [] | 0 |
determine-color-of-a-chessboard-square | Ruby - Two solutions | ruby-two-solutions-by-shhavel-jat7 | First solution\n\nCheck vertical and then horisontal even or odd.\n\nruby\ndef square_is_white(coordinates)\n x = coordinates[0]\n y = coordinates[1].to_i\n | shhavel | NORMAL | 2021-04-03T19:59:21.645130+00:00 | 2021-04-03T19:59:21.645171+00:00 | 72 | false | ### First solution\n\nCheck vertical and then horisontal even or odd.\n\n```ruby\ndef square_is_white(coordinates)\n x = coordinates[0]\n y = coordinates[1].to_i\n %w[b d f h].include?(x) ? y.odd? : y.even?\nend\n```\n\n### Second solution\n\nRely on characters byte codes\n\n```ruby\ndef square_is_white(coordinates)... | 3 | 0 | ['Ruby'] | 1 |
determine-color-of-a-chessboard-square | [C++] 0ms Bitwise Solution Explained | c-0ms-bitwise-solution-explained-by-ajna-hnfw | Oh, I remember doing this one years ago on another platform and in C++ it is even easier, since you don\'t actually need to compare characters and/or turn them | ajna | NORMAL | 2021-04-03T17:14:05.109767+00:00 | 2021-04-05T12:57:33.367597+00:00 | 155 | false | Oh, I remember doing this one years ago on another platform and in C++ it is even easier, since you don\'t actually need to compare characters and/or turn them into numbers.\n\nWe are going to return `false` when the last bit of the ascii code of both characters is the same, `true` otherwise.\n\n```cpp\nclass Solution ... | 3 | 2 | ['Bit Manipulation', 'C', 'C++'] | 0 |
determine-color-of-a-chessboard-square | 1 line C++ | 1-line-c-by-googlenick-p7di | \nclass Solution {\npublic:\n bool squareIsWhite(string coordinates) {\n return (coordinates[0] - \'1\' + coordinates[1] - \'a\') % 2;\n }\n};\n | GoogleNick | NORMAL | 2021-04-03T16:07:28.832121+00:00 | 2021-04-03T16:07:28.832159+00:00 | 73 | false | ```\nclass Solution {\npublic:\n bool squareIsWhite(string coordinates) {\n return (coordinates[0] - \'1\' + coordinates[1] - \'a\') % 2;\n }\n};\n``` | 3 | 1 | [] | 0 |
determine-color-of-a-chessboard-square | Very Short Code and Beat 100% | very-short-code-and-beat-100-by-charnavo-szf2 | Could you explain why bad heft? | charnavoki | NORMAL | 2025-01-25T19:15:24.488187+00:00 | 2025-01-25T19:15:24.488187+00:00 | 50 | false | Could you explain why `bad heft`?
```javascript []
const squareIsWhite = (c) =>
('bad heft'.indexOf(c[0]) + +c[1]) % 2;
``` | 2 | 0 | ['JavaScript'] | 1 |
determine-color-of-a-chessboard-square | Easy way to understand it is done by toggling the state | easy-way-to-understand-it-is-done-by-tog-yira | Intuitionabsorb the black and white position of blocks, on odd position row start with black box, and at even position block start with white box, just find coo | Gaurav_krrr | NORMAL | 2025-01-23T16:16:48.403792+00:00 | 2025-01-23T16:16:48.403792+00:00 | 97 | false | # Intuition
absorb the black and white position of blocks, on odd position row start with black box, and at even position block start with white box, just find coordinate and convert into integer and i toggle the the flag number of times of column
# Approach
1. find row and column
2. row decide weather start of box i... | 2 | 0 | ['C++'] | 0 |
determine-color-of-a-chessboard-square | agar same parity toh black vrna white utna hee convert a to 1 b to 2 c to 3 ...aisa :D | agar-same-parity-toh-black-vrna-white-ut-egxn | Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time | yesyesem | NORMAL | 2024-09-04T09:23:27.766086+00:00 | 2024-09-04T09:23:27.766126+00:00 | 52 | false | # Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ --... | 2 | 0 | ['C++'] | 0 |
determine-color-of-a-chessboard-square | ✅✅ JAVA || 100%✅✅ | java-100-by-bhavesh_03-ie25 | Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time | bhavesh_03 | NORMAL | 2024-09-01T03:35:56.273077+00:00 | 2024-09-01T03:35:56.273098+00:00 | 90 | false | # Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ --... | 2 | 0 | ['Java'] | 0 |
determine-color-of-a-chessboard-square | Easy to understand | 100% beat using C++ | O(1) time and space complexity... | easy-to-understand-100-beat-using-c-o1-t-cpyu | Intuition\nWe are just checking if both the coordinates are even or both are odd.\n# Approach\nFirst we divide our coordinates in two parts. First part is a cha | sushant_007 | NORMAL | 2024-03-04T08:33:35.218742+00:00 | 2024-03-04T08:33:35.218780+00:00 | 412 | false | # Intuition\nWe are just checking if both the coordinates are even or both are odd.\n# Approach\nFirst we divide our coordinates in two parts. First part is a character, so we are changing it into integer by subtracting \'a\' from the letter. After that we are just checking if both the coordinates are even or if both a... | 2 | 0 | ['String', 'C++'] | 1 |
determine-color-of-a-chessboard-square | Easy method in python | easy-method-in-python-by-arun_balakrishn-04w9 | \n# Code\n\nclass Solution:\n def squareIsWhite(self, coordinates: str) -> bool:\n dict = {\'a\':1, \'b\':2, \'c\':3, \'d\':4, \'e\':5, \'f\':6 , \'g\ | arun_balakrishnan | NORMAL | 2024-02-10T17:54:26.601684+00:00 | 2024-02-10T17:54:26.601712+00:00 | 104 | false | \n# Code\n```\nclass Solution:\n def squareIsWhite(self, coordinates: str) -> bool:\n dict = {\'a\':1, \'b\':2, \'c\':3, \'d\':4, \'e\':5, \'f\':6 , \'g\':7, \'h\':8}\n if dict[coordinates[0]] % 2 == int(coordinates[1]) % 2:\n return False\n else:\n return True \n \n... | 2 | 0 | ['Python3'] | 0 |
determine-color-of-a-chessboard-square | simple and easy | simple-and-easy-by-shishirrsiam-p1m0 | Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time | shishirRsiam | NORMAL | 2024-01-29T10:44:43.140568+00:00 | 2024-01-29T10:44:43.140599+00:00 | 32 | false | # Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ --... | 2 | 0 | ['C++'] | 0 |
determine-color-of-a-chessboard-square | Best Java Solution || Beats 100% | best-java-solution-beats-100-by-ravikuma-d7uv | Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time | ravikumar50 | NORMAL | 2023-10-08T17:12:48.379137+00:00 | 2023-10-08T17:12:48.379164+00:00 | 163 | false | # Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ --... | 2 | 0 | ['Java'] | 0 |
determine-color-of-a-chessboard-square | Java Simple Solution || Determine Color of a Chessboard Square | java-simple-solution-determine-color-of-fdb8m | Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time | vsmore2001 | NORMAL | 2023-08-31T10:02:35.023687+00:00 | 2023-08-31T10:02:35.023710+00:00 | 216 | false | # Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ --... | 2 | 0 | ['Java'] | 1 |
determine-color-of-a-chessboard-square | JAVA CODE||100%FAST SHORTCUT | java-code100fast-shortcut-by-madhav_rav_-3r1n | Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time | Madhav_Rav_Tripathi | NORMAL | 2023-08-16T13:02:31.234817+00:00 | 2023-08-16T13:02:31.234846+00:00 | 25 | false | # Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ --... | 2 | 0 | ['Java'] | 1 |
determine-color-of-a-chessboard-square | 100% beats. easy JAVA solution using one if condition. | 100-beats-easy-java-solution-using-one-i-cbbd | Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\ncheck the numbers on | saurabh2306 | NORMAL | 2023-07-05T18:08:07.269364+00:00 | 2023-07-05T18:08:07.269391+00:00 | 317 | false | # Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\ncheck the numbers on the column are form 1 to 8\nsimilarly, consider character \'a\' on horizontal row as 1 \n\nsuch as \'a\'= 1\nand \'b\'= 2 ...\n\nnow if we get t... | 2 | 0 | ['Java'] | 0 |
determine-color-of-a-chessboard-square | Simple 3 liner solution- C++ (0ms runtime) | simple-3-liner-solution-c-0ms-runtime-by-7ckq | Code\n\nclass Solution {\npublic:\n bool squareIsWhite(string coordinates) {\n if (coordinates[0]%2==0 && coordinates[1]%2!=0) return true;\n e | phalakbh | NORMAL | 2023-06-27T10:40:19.521893+00:00 | 2023-06-27T10:40:19.521928+00:00 | 631 | false | # Code\n```\nclass Solution {\npublic:\n bool squareIsWhite(string coordinates) {\n if (coordinates[0]%2==0 && coordinates[1]%2!=0) return true;\n else if (coordinates[0]%2!=0 && coordinates[1]%2==0) return true;\n else return false;\n }\n};\n```\nan upvote is appreciated! :) | 2 | 0 | ['Math', 'String', 'C++'] | 0 |
determine-color-of-a-chessboard-square | 💯% beats. easy solution only using if and else. | beats-easy-solution-only-using-if-and-el-hq9s | Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time | hikmatulloanvarbekov001 | NORMAL | 2023-06-27T04:42:56.204704+00:00 | 2023-06-27T04:42:56.204741+00:00 | 179 | false | # Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ --... | 2 | 0 | ['Java'] | 0 |
determine-color-of-a-chessboard-square | 📌📌 0 ms | Java | easy peasy lemon squeezy | 0-ms-java-easy-peasy-lemon-squeezy-by-sa-j7d2 | \n\n# Code\n\nclass Solution {\n public boolean squareIsWhite(String coordinates) {\n int ch1 = (coordinates.charAt(0) - \'a\') + 1;\n int ch | Sauravmehta | NORMAL | 2023-03-26T11:40:38.597671+00:00 | 2023-03-26T11:40:38.597704+00:00 | 232 | false | \n\n# Code\n```\nclass Solution {\n public boolean squareIsWhite(String coordinates) {\n int ch1 = (coordinates.charAt(0) - \'a\') + 1;\n int ch2 = (coordinates.charAt(1) - \'1\') + 1;\n if(ch2 % 2 == 0){\n if(ch1 % 2 == 0) return false;\n else return true;\n }\n... | 2 | 0 | ['Java'] | 0 |
determine-color-of-a-chessboard-square | Just some mathematics using JavaScript! | just-some-mathematics-using-javascript-b-0hjm | Complexity\n- Time complexity: O(1)\n Add your time complexity here, e.g. O(n) \n\n- Space complexity: O(1)\n Add your space complexity here, e.g. O(n) \n\n# Co | narasimhakamath | NORMAL | 2023-02-03T14:50:50.801312+00:00 | 2023-02-03T14:50:50.801355+00:00 | 285 | false | # Complexity\n- Time complexity: O(1)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: O(1)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nconst squareIsWhite = coordinates => (((coordinates.charCodeAt(0) - 97) + (coordinates[1] - 1)) % 2);\n\n``` | 2 | 0 | ['JavaScript'] | 0 |
determine-color-of-a-chessboard-square | Easy Java Solution by DEV | easy-java-solution-by-dev-by-devrb_20cse-2e14 | Easy Understanding Java solution\n Describe your first thoughts on how to solve this problem. \n\n# Brute Force\n Describe your approach to solving the problem. | devrb_20cse | NORMAL | 2023-01-28T06:16:02.341584+00:00 | 2023-01-28T06:16:02.341634+00:00 | 1,192 | false | # Easy Understanding Java solution\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Brute Force\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:O(1)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:O(1)\n<!-- Add your space... | 2 | 0 | ['Java'] | 1 |
determine-color-of-a-chessboard-square | Java solution with 0ms runtime | TC = O(n) | Beats 100% | java-solution-with-0ms-runtime-tc-on-bea-xngl | If you found it easy to understand, Please do upvote :)\nThankyou!!\n------------------------------------------------------------------------------------------- | JavithSadhamHussain | NORMAL | 2022-12-29T08:47:08.204600+00:00 | 2022-12-29T08:47:08.204626+00:00 | 599 | false | **If you found it easy to understand, Please do upvote :)\nThankyou!!**\n**--------------------------------------------------------------------------------------------------**\n**-------------... | 2 | 0 | ['Math', 'String', 'Java'] | 0 |
determine-color-of-a-chessboard-square | Python Solution O(1) Time Complexity | python-solution-o1-time-complexity-by-sh-5f2u | Approach\nConverting the co-ordinates to the indexes as per the chessboard grid. If the sum of the two indexes is even then return False else return True.\n\n# | ShauryaSarswat | NORMAL | 2022-11-28T05:54:31.898308+00:00 | 2022-11-28T05:55:05.757855+00:00 | 94 | false | # Approach\nConverting the co-ordinates to the indexes as per the chessboard grid. If the sum of the two indexes is even then return **False** else return **True**.\n\n# Complexity\n- Time complexity:\nO(1)\n\n- Space complexity:\nO(2n)\n\n# Code\n```\nclass Solution(object):\n def squareIsWhite(self, coordinates):\... | 2 | 0 | ['Python'] | 0 |
determine-color-of-a-chessboard-square | 1 line solution with "ord" O(1) | 1-line-solution-with-ord-o1-by-mencibi-5uzk | Code\n\nclass Solution:\n def squareIsWhite(self, C: str) -> bool:\n return (ord(C[0]) + ord(C[1])) & 1\n | Mencibi | NORMAL | 2022-11-03T13:23:08.361269+00:00 | 2022-11-03T13:26:50.116601+00:00 | 634 | false | # Code\n```\nclass Solution:\n def squareIsWhite(self, C: str) -> bool:\n return (ord(C[0]) + ord(C[1])) & 1\n``` | 2 | 0 | ['Python3'] | 0 |
determine-color-of-a-chessboard-square | ✅ Beats 100% ✅ One line solution | javascript-simple-solution-9040-faster-a-6yr4 | IntuitionLets determine if the sum of the ASCII values of the column and row is odd or even to decide if the chessboard square is white or black.ApproachThe app | katrusya_ | NORMAL | 2022-10-26T15:20:08.850212+00:00 | 2025-04-05T21:32:28.350950+00:00 | 30 | false | # Intuition
Lets determine if the sum of the ASCII values of the column and row is odd or even to decide if the chessboard square is white or black.
# Approach
<!-- Describe your approach to solving the problem. -->
The approach calculates the ASCII values of the column and row in the chessboard coordinate, then adds t... | 2 | 0 | ['Math', 'String', 'JavaScript'] | 0 |
determine-color-of-a-chessboard-square | Determine Color of a Chessboard Square || C++ Solution | determine-color-of-a-chessboard-square-c-u7qb | \nclass Solution {\npublic:\n bool squareIsWhite(string coordinates) {\n if(((coordinates[0]-\'a\')+(coordinates[1]-\'0\'))%2==0)\n {\n | SAJAL_2526 | NORMAL | 2022-10-17T19:18:11.214233+00:00 | 2022-10-17T19:18:11.214276+00:00 | 581 | false | ```\nclass Solution {\npublic:\n bool squareIsWhite(string coordinates) {\n if(((coordinates[0]-\'a\')+(coordinates[1]-\'0\'))%2==0)\n {\n return true;\n }\n return false;\n }\n};\n``` | 2 | 0 | ['C'] | 0 |
determine-color-of-a-chessboard-square | java | java-by-niyazjava-wl1e | \n\n public boolean squareIsWhite(String coordinates) {\n return (coordinates.charAt(0) - \'a\'+ coordinates.charAt(1))%2==0;\n }\n\t\n | NiyazJava | NORMAL | 2022-10-12T11:15:06.050683+00:00 | 2022-10-12T11:15:06.050717+00:00 | 263 | false | ```\n\n public boolean squareIsWhite(String coordinates) {\n return (coordinates.charAt(0) - \'a\'+ coordinates.charAt(1))%2==0;\n }\n\t\n``` | 2 | 0 | ['Java'] | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.