3280. Convert Date to Binary Easy

@problem@discussion
#Math#String



1/**
2 * [3280] Convert Date to Binary
3 *
4 * You are given a string date representing a Gregorian calendar date in the yyyy-mm-dd format.
5 * date can be written in its binary representation obtained by converting year, month, and day to their binary representations without any leading zeroes and writing them down in year-month-day format.
6 * Return the binary representation of date.
7 *  
8 * <strong class="example">Example 1:
9 * <div class="example-block">
10 * Input: <span class="example-io">date = "2080-02-29"</span>
11 * Output: <span class="example-io">"100000100000-10-11101"</span>
12 * Explanation:
13 * <span class="example-io">100000100000, 10, and 11101 are the binary representations of 2080, 02, and 29 respectively.</span>
14 * </div>
15 * <strong class="example">Example 2:
16 * <div class="example-block">
17 * Input: <span class="example-io">date = "1900-01-01"</span>
18 * Output: <span class="example-io">"11101101100-1-1"</span>
19 * Explanation:
20 * <span class="example-io">11101101100, 1, and 1 are the binary representations of 1900, 1, and 1 respectively.</span>
21 * </div>
22 *  
23 * Constraints:
24 * 
25 * 	date.length == 10
26 * 	date[4] == date[7] == '-', and all other date[i]'s are digits.
27 * 	The input is generated such that date represents a valid Gregorian calendar date between Jan 1^st, 1900 and Dec 31^st, 2100 (both inclusive).
28 * 
29 */
30pub struct Solution {}
31
32// problem: https://leetcode.com/problems/convert-date-to-binary/
33// discuss: https://leetcode.com/problems/convert-date-to-binary/discuss/?currentPage=1&orderBy=most_votes&query=
34
35// submission codes start here
36
37impl Solution {
38    pub fn convert_date_to_binary(date: String) -> String {
39        String::new()
40    }
41}
42
43// submission codes end
44
45#[cfg(test)]
46mod tests {
47    use super::*;
48
49    #[test]
50    fn test_3280() {
51    }
52}
53


Back
© 2025 bowen.ge All Rights Reserved.