算法
田昕峣 Richard
这个作者很懒,什么都没留下…
展开
-
使用Python统计连续日期
输入为一串日期的长字符串,每个日期之间使用 "," 分隔开。days_str = '''2021-11-17,2021-11-19,2021-11-20,2021-11-21,2021-11-23'''统计连续出现日期的最大天数。 def calculate_consecutive_dates(dates_str: str): max_consecutive_days = 0 temp_flag = 0 dates_l...原创 2021-11-29 15:35:17 · 1568 阅读 · 0 评论 -
算法研习:Validate Subsequence
Solution:using System;using System.Collections.Generic;public class Program{ public static bool IsValidSubsequence(List<int> array, List<int> sequence) { // Write your code here. int targetIndex = 0; for (int i = 0; i < arr..原创 2021-01-25 09:35:17 · 135 阅读 · 0 评论 -
算法研习: Two Number Sum
Solution: public class Program { public static int[] TwoNumberSum(int[] array, int targetSum) { // Write your code here. // set index of the first element for (int i = 0; i < array.Length; i++) { // set index of the se..原创 2021-01-25 08:38:40 · 106 阅读 · 0 评论