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
| intent('What does this app do?', 'What can I do here?', | |
| reply('This is a news project.')); | |
| const API_KEY = '7bdfb1b10aca41c6becea47611b7c35a'; | |
| let savedArticles = []; | |
| // News by Source | |
| intent('Give me the news from $(source* (.*))', (p) => { | |
| let NEWS_API_URL = `https://newsapi.org/v2/top-headlines?apiKey=${API_KEY}`; | |
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
| //Legendre's 3-square theorem | |
| class Solution { | |
| public: | |
| int numSquares(int n) { | |
| if(ceil(sqrt(n))==floor(sqrt(n))) | |
| return 1; | |
| while(n%4==0) //Remove 4^a term | |
| n/=4; | |
| if(n%8==7) //check if the no now is in the form of (8b + 7) |
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 maximalSquare(vector<vector<char>>& matrix) { | |
| int rows = matrix.size(); | |
| if(rows==0) | |
| return 0; | |
| int cols = matrix[0].size(); | |
| vector<vector<int>> dp(rows+1,vector<int>(cols+1,0)); |