当前位置:网站首页>[daily 3 questions (1)] judge the color of a grid on the chess board
[daily 3 questions (1)] judge the color of a grid on the chess board
2022-06-29 11:13:00 【Programmed ape without hair loss 2】
subject :
Give you a coordinate coordinates , It's a string , Represents the coordinates of a grid in a chess board . The following is a schematic diagram of the chess board .

If the color of the given grid is white , Please return true, If it's black , Please return false .
The given coordinates must represent an existing grid on the chess board . The first character in the coordinates is the letter , The second character is the number .
Example 1:
Input :coordinates = “a1”
Output :false
explain : As shown on the chessboard above ,“a1” The coordinates of the grid are black , So back false .
Example 2:
Input :coordinates = “h3”
Output :true
explain : As shown on the chessboard above ,“h3” The grid of coordinates is white , So back true .
Example 3:
Input :coordinates = “c7”
Output :false
Tips :
coordinates.length == 2
‘a’ <= coordinates[0] <= ‘h’
‘1’ <= coordinates[1] <= ‘8’
java Code :
class Solution {
public boolean squareIsWhite(String coordinates) {
return (coordinates.charAt(0) + coordinates.charAt(1)) %2>0;
}
}
边栏推荐
- crypto 1~5
- Google Earth Engine(GEE)——GEDI L2A Vector Canopy Top Height (Version 2) 全球生态系统数据集
- Modbustcp protocol network learning single channel infrared module (medium shell version)
- 云原生开发必备:首个通用无代码开发平台 iVX 编辑器
- 【NLP】文本生成专题1:基础知识
- Limit introduction summary
- Spark - one to one correspondence between task and partition and detailed explanation of parameters
- (JS)手写深拷贝
- crypto 1~5
- (JS)isNaN()方法判断undefined为true的原因
猜你喜欢

任职 22 年,PowerShell 之父将从微软离职:曾因开发 PowerShell 被微软降级过

Multi thread communication between client and server (primary version)

The encryption market has exploded one after another. Can Celsius avoid bankruptcy?

非凸联合创始人李佐凡:将量化作为自己的终身事业

励志!专科“逆袭”读浙大硕士,3篇SCI,最终成清华博士!

【每日3题(3)】重新格式化电话号码

ModbusTCP协议WIFI无线学习型单路红外模块(小壳版)

Pipeline aggregations管道聚合- parent-2

ModbusTCP协议网络学习型单路红外模块(双层板)

Reids设计与实现
随机推荐
Modbus RTU 协议485学习型2路红外模块
ZABBIX monitors various MySQL indicators
Dropout layer
Data analysis method and Thinking: funnel analysis
Google Earth engine (GEE) - Gedi L2a vector canopy top height (version 2) global ecosystem data set
Modbustcp protocol WiFi wireless learning single channel infrared module (round shell version)
【数字信号调制】基于 AM+FM+DSB+SSB实现信号调制解调含Matlab源码
STM32F1与STM32CubeIDE编程实例-超声波测距传感器驱动
Exemples de programmation stm32f1 et stm32cubeide - entraînement du capteur de portée ultrasonique
Recommended embedded learning books [easy to understand]
Bs-gx-018 student examination system based on SSM
工具箱之 IKVM.NET 项目新进展
Mastering the clever use of some shell wildcards will make us write with half the effort
9 easy to use JSON processing tools, greatly improving efficiency!
TTL串口学习型红外遥控模块可扩展成网络控制
Map merges the same keys and values into a list
(JS) handwritten deep copy
在Clion中使用EasyX配置
TTL serial port learning infrared remote control module can be extended to network control
Please tell me about the Flink SQL batch task, two or more tables join (inner join or outer join