Skip to content

Instantly share code, notes, and snippets.

View ZhangYW18's full-sized avatar

Yiwei Zhang ZhangYW18

  • Brown University
  • New York City Metropolitan Area
View GitHub Profile
@ZhangYW18
ZhangYW18 / palettes.png
Created April 24, 2024 15:47 — forked from mwaskom/palettes.png
Show all seaborn palettes and simulate what they look like with various color vision deficiencies. (The 10-element seaborn palettes will be part of the forthcoming 0.9 release).
palettes.png

Keybase proof

I hereby claim:

  • I am zhangyw18 on github.
  • I am kanan2390 (https://keybase.io/kanan2390) on keybase.
  • I have a public key ASAgl0dNUqtddZgR6if_Ok5FAAK9UVexq3Q5kileXgbJnQo

To claim this, I am signing this object:

#include <bits/stdc++.h>
class Solution {
public:
string longestPalindrome(string s) {
string t=s, ans="";
reverse(t.begin(), t.end());
int n=s.length();
for (int i=0;i<n;i++) {
int k=0;
class Solution {
public:
int findKthElement(vector<int>& n1, vector<int>& n2, int i,int j,int k) {
if (i>=n1.size()) return n2[j+k-1];
if (j>=n2.size()) return n1[i+k-1];
if (k==1) return min(n1[i], n2[j]);
int mid1 = i+k/2-1>=n1.size() ? INT_MAX : n1[i+k/2-1];
int mid2 = j+k/2-1>=n2.size() ? INT_MAX : n2[j+k/2-1];
if (mid1 < mid2)
return findKthElement(n1, n2, i+k/2, j, k-k/2);
class Solution {
public:
int lengthOfLongestSubstring(string s) {
unordered_map<char,int> dic;
int ans=0, h=0, n=s.length();
for (int i=0;i<n;i++) {
dic[s[i]]++;
while (dic[s[i]]>1) {
dic[s[h]]--;
h++;
// LeetCode 2 - Add Two Numbers
/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode() : val(0), next(nullptr) {}
* ListNode(int x) : val(x), next(nullptr) {}
* ListNode(int x, ListNode *next) : val(x), next(next) {}
* };