原创 linux下運行Windows下寫的bash腳本

運行bash腳本出現了$'\r': command not found問題 系windos和linux的換行符差異,解決方案: 用vim打開bash腳本,esc模式下set ff=unix,保存後重新運行就不會報錯了。  

原创 conda環境中關於tensorflow的報錯

由於conda環境中的tensorflow缺乏absl包,引發如上所示報錯,解決方案:conda install absl-py

原创 LeetCode-Diameter_of_Binary_Tree

題目: Given a binary tree, you need to compute the length of the diameter of the tree. The diameter of a binary tree is t

原创 LeetCode-Queue_Reconstruction_by_Height

題目: Suppose you have a random list of people standing in a queue. Each person is described by a pair of integers (h, k)

原创 LeetCode-Palindromic_Substrings

題目: Given a string, your task is to count how many palindromic substrings in this string. The substrings with different

原创 LeetCode-Reverse_Words_in_a_String_III

題目:Given a string, you need to reverse the order of characters in each word within a sentence while still preserving wh

原创 LeetCode-Student_Attendance_Record_I

題目: You are given a string representing an attendance record for a student. The record only contains the following thre

原创 LeetCode-Counting_Bits

題目: Given a non negative integer number num. For every numbers i in the range 0 ≤ i ≤ num calculate the number of 1's i

原创 C++小技巧

1.利用istringstream將字符串按空格分隔#include<sstream> string s="a b cd efg"; string t=""; istringstream is(s); while(s>>t) co

原创 LeetCode-Reverse_String_II

題目:Given a string and an integer k, you need to reverse the first k characters for every 2k characters counting from th

原创 LeetCode-Merge_Two_Binary_Trees

題目: Given two binary trees and imagine that when you put one of them to cover the other, some nodes of the two trees ar

原创 LeetCode-Minimum_Absolute_Difference_in_BST

題目:Given a binary search tree with non-negative values, find the minimum absolute difference between values of any two

原创 LeetCode-Longest_Uncommon_Subsequence_I

題目:Given a group of two strings, you need to find the longest uncommon subsequence of this group of two strings. The lo

原创 LeetCode-Perfect_Number

題目:We define the Perfect Number is a positive integer that is equal to the sum of all its positive divisors except itse

原创 LeetCode-K-diff_Pairs_in_an_Array

題目:Given an array of integers and an integer k, you need to find the number of unique k-diff pairs in the array. Here a