-
-
Save prakhar987/711f9474b9ba24096ebe37c28991ad2a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Solution { | |
public: | |
struct Trie{ | |
vector<Trie *>child; | |
int index=-1; | |
}; | |
void insert(Trie *root,string s,int index) | |
{ | |
int index; | |
for(int i=0;i<s.size();i++) | |
{ | |
index=s[i] -'a'; | |
if(root->child[index]==NULL) | |
root->child[index]=new Trie(); | |
root=root->child[index]; | |
} | |
root->index=index; | |
} | |
int find(Trie *root, string s) | |
{ | |
int index; | |
for(int i=0;i<s.size();i++) | |
{ | |
index=s[i] - 'a'; | |
if(root->child[index]==NULL) | |
return false; | |
root=root->child[index]; | |
} | |
return root->index; | |
} | |
vector<vector<int>> palindromePairs(vector<string>& words) { | |
// Build the reversed trie | |
Trie *root=new Trie(); | |
for(int i=0;i<words.size();i++) | |
insert(root,reverse(words[i].begin(),words[i].end()),i); | |
// Start Traversal | |
vector<vector<int>>answer(); | |
vector<int>tmp(2,0); | |
for(int i=0;i<words.size();i++) | |
{ | |
} | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation
import matplotlib.image as mpimg
from math import sin,cos
import time
Load Image and Variables
img = mpimg.imread('./image.png')
step=20
start=time.time()
def data_gen():
gen_list = ([t,t] for t in np.arange(200,300,0.1))
return gen_list
def init():
pass
fig, ax = plt.subplots()
point, = ax.plot([0], [0], 'ro')
point.set_data(0, 0)
point1, = ax.plot([0], [0], 'ro')
point1.set_data(0, 0)
##Stationary Point
point2, = ax.plot([0], [0], 'bo')
point2.set_data(0, 0)
point3, = ax.plot([0], [0], 'bo')
point3.set_data(0, 0)
point4, = ax.plot([0], [0], 'bo')
point4.set_data(0, 0)
point5, = ax.plot([0], [0], 'bo')
point5.set_data(0, 0)
##Line
line, = ax.plot([], [], lw=2,ls='solid',c='y')
ax.grid()
plt.imshow(img)
def run(data):
ani = animation.FuncAnimation(fig, run, data_gen, init_func=init,interval=10)
plt.show()