/*Welcome to Facebook! This is just a simple shared plaintext pad, with no execution capabilities. When you know what language you‘d like to use for your interview, simply choose it from the dropdown in the top bar. Enjoy your interview! hello! 1 2 3 5 2 4 6 -> 4*/ #include <vector> #include <iostream> int findLongestContinousSequence(vector<int>&nums) { if(nums.size()) return 0; int cnt = 1; int max_cnt = 1; for(int i = 1;i<nums.size();i++) { if(nums[i]>=nums[i-1]) cnt++; else cnt= 1; max_cnt = max(max_cnt,cnt); } return max_cnt; } dp[i] = dp[j]+1;//for j between [0,i] if nums[i]>nums[j]; int main() { vector<int> nums = {7,3,5,8,9,2,3,10}; int cnt = findLongestContinousSequence(nums); cout << cnt << endl; } dot product v1 = [1, 0, 1] v2 = [1, 1, 1] v1 dp v2 = 1 + 0 + 1= 2 struct node { int idx int val; node(int _idx,int _val) { idx = _idx; val = _val; } } bool get_data(vector<node>&data1,vector<node>&data2) class dotProduct { int dot_product() { vector<node> dat1,dat2; int sum = 0; get_data(dat1,dat2) int idx1 = 0,idx2 = 0; // O(min(dat1.size(),dat2.size()) while(idx1<dat1.size() && idx2<dat2.size()) { if(dat1[idx1].idx == dat2[idx2].idx) sum += dat1[idx1].val*dat2[idx2].val; else if (dat1[idx1].idx == dat2[idx2].idx) idx1++; else idx2++; } return sum; } }