This file contains hidden or 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 Tree | |
attr_accessor :data, :left, :right | |
def initialize(data) | |
@data = data | |
end | |
end | |
def insert(root, data) | |
if data > root.data | |
if !root.right |
This file contains hidden or 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
def alphabet_board_path(target) | |
board = [ | |
['a','b','c','d','e'], | |
['f','g','h','i','j'], | |
['k','l','m','n','o'], | |
['p','q','r','s','t'], | |
['u','v','w','x','y'], | |
['z'] | |
] | |
answer = [] |
This file contains hidden or 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
n = gets.to_i | |
count = [] | |
a = [] | |
n.times do | |
count << gets.to_i | |
s = gets.strip.split(/\s+/).map(&:to_i) | |
a << s | |
#p sum.max | |
end | |
a.each do |i| |
This file contains hidden or 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: | |
int maxProfit(vector<int>& prices) { | |
if(prices.size() <= 1){ | |
return 0; | |
} | |
int max=-9999,min; | |
vector<int> max_profit; | |
vector<int> min_uptil; | |
min_uptil.push_back(prices[0]); |
This file contains hidden or 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
/* | |
Question: | |
You are located at the top-left corner of a mxn grid. You can only move either right or down at any point in time. | |
Your home is located at the bottom right corner of this grid. In how many unique ways can you reach your home? | |
*/ | |
#include <iostream> | |
#include <vector> | |
using namespace std; |
This file contains hidden or 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
#include <iostream> | |
#include <vector> | |
using namespace std; | |
int main(){ | |
vector<vector<int>> name = {{1,2,3},{4,5,6}}; | |
for(int i=0;i<name.size();i++){ | |
for(int j=0;j<name[i].size();j++){ | |
cout << name[i][j] << " "; | |
} |
This file contains hidden or 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
#include <iostream> | |
using namespace std; | |
int main(){ | |
int a = 5; | |
int b = 78; | |
//Defining a Lambda function : [capture_local_var](parameters){}(); | |
//Simple hello |
This file contains hidden or 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
#include <iostream> | |
#include <map> | |
using namespace std; | |
int main(){ | |
map<int,string> m; | |
m.insert(pair<int,string>(1,"Apple")); | |
m.insert(pair<int,string>(2,"Banana")); | |
m.insert(pair<int,string>(3,"Litchi")); |
This file contains hidden or 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
created(){ // As soon as the page loads.. | |
axios.get('http://localhost:3000/api/v1/users.json') | |
.then(res => { | |
for(var i=0;i<res.data.length;i++){ | |
console.log(res.data[0].email) | |
} | |
}) | |
} |
This file contains hidden or 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
<transition | |
enter-active-class="animated fadeIn" | |
leave-active-class="animated fadeOut"> | |
<div v-if="show" class="alert alert-success"> | |
<strong>Success!</strong> Indicates a successful or positive action. | |
</div> | |
</transition> |