raptors slowly coming back
raptors slowly coming back
@Miggs siakim is still on the trading block right
essentially I do pre and post sales non technical engineering the other 30% of my time at work i do programmingWhat do you do for your day job, if you don't mind me asking?
essentially I do pre and post sales non technical engineering the other 30% of my time at work i do programming
#include <iostream>
#include <vector>
#include <string>
#include <math.h>
struct Point {
int x, y ;
} ;
int distance( const Point& p1, const Point& p2 ) {
int a = (p1.x - p2.x) * (p1.x - p2.x) ;
int b = (p1.y - p2.y) * (p1.y - p2.y) ;
return sqrt( a + b ) ;
}
Point findClosestCoin( const Point& yourPosition, const std::vector<Point>& coins ) {
int shortest = 1000 ;
int idx = 0, i = 0 ;
for( const Point& p : coins ) {
if( distance( yourPosition, p ) < shortest ) {
shortest = distance( yourPosition, p ) ;
idx = i ;
}
i++ ;
}
return coins[ idx ] ;
}
int main( int argc, char** argv )
{
Point myPosition{ 10, 0 } ;
std::vector<Point> coins ;
coins.push_back( Point{ 1, 2 } ) ;
coins.push_back( Point{ 10, 2} ) ;
coins.push_back( Point{ 22, 3} ) ;
coins.push_back( Point{ 3, 4 } ) ;
coins.push_back( Point{ 4, 1 } ) ;
coins.push_back( Point{ 5, 1 } ) ;
auto shortestPoint = findClosestCoin( myPosition, coins ) ;
std::cout << "closestCoin: (" << shortestPoint.x << "," << shortestPoint.y << ")" ;
std::cin.get() ;
return 0 ;
}
namespace bullshytutility
{
struct Tuple {
int a ;
int b ;
} ;
bool search( const std::vector<int>& container, int target ) {
for( auto itr : container ) {
if( itr == target )
return true ;
}
return false ;
}
int findMissingInt( const std::vector<int>& a, const std::vector<int>& b ) {
if( a.size() == 0 || b.size() == 0 )
return -1 ;
for( auto i : a ) {
if( !search( b, i ) )
return i ;
}
return -1 ;
}
}
int main() {
std::vector<int> a{ 4, 12, 9, 5, 6 } ;
std::vector<int> b{ 4, 9, 12, 6 } ;
auto c = bullshytutility::findMissingInt( a, b ) ;
std::cout << "Missing Number: " << c << '\n' ;
return 0 ;
}
namespace bullshytutility
{
struct Meeting {
std::string name ;
int hours ;
} ;
bool sortByHours( const Meeting& lhs, const Meeting& rhs ) { return lhs.hours < rhs.hours ; }
std::vector<Meeting> optimizeMeetingTime( const std::vector<Meeting>& meetings, int availableTime ) {
std::vector<Meeting> shortMeetings ;
for( auto meeting : meetings )
if( meeting.hours < availableTime )
shortMeetings.push_back( meeting ) ;
std::sort( shortMeetings.begin(), shortMeetings.end(), sortByHours ) ;
std::vector<Meeting> optimizedMeetings ;
std::vector<Meeting>::iterator meeting = shortMeetings.begin() ;
for( int sum = 0 ; sum < availableTime ; ) {
if( sum + (*meeting).hours > availableTime )
break ;
sum += (*meeting).hours ;
optimizedMeetings.push_back( (*meeting) ) ;
++meeting ;
}
return optimizedMeetings ;
}
}
int main() {
std::vector<bullshytutility::Meeting> meetings{
bullshytutility::Meeting{ "Meet Subordinates", 2 },
bullshytutility::Meeting{ "Fire Janitor", 1 },
bullshytutility::Meeting{ "Meet Clients", 3 },
bullshytutility::Meeting{ "Bang Secretary", 1 },
bullshytutility::Meeting{ "Bang HR Lady", 2 },
bullshytutility::Meeting{ "Meet Boss", 4 }
} ;
auto optMeetings = bullshytutility::optimizeMeetingTime( meetings, 3 ) ;
for( auto i : optMeetings )
std::cout << "Name: " << i.name << "\nHours: " << i.hours << "\n\n" ;
std::cin.get() ;
return 0 ;
}
Just had my first tech interview since I landed my current job out of college and I bombed that shyt man ..
The behavioral and technical portions werent too bad but the whiteboarding came and destroyed me.... I went totally blank. Couldnt remember how to do anything
Humbled the hell outta me. Copped a years subscription to leetcode, I'm never letting this ish happen to me again
Here you go.
Tech Careers: New Year Gift - Curated List of Top 75 LeetCode Questions to Save Your Time
Loading...
Don't go too deep into algorithms. You'll never be asked to write a suffix tree or a balanced tree, or even Dijkstra's shortest path algorithm. You need to know the following algorithms: sorting (quick, merge, counting, radix -sort algorithms), binary search, DFS, BFS, DSU (might be useful, and it's a pretty easy data structure), stacks, min/max stack, queues, heaps, linked lists, KMP, hashes (Rabin-Karp). Segment Tree and/or Binary Indexed Tree (aka Fenwick tree) might be useful, and even though you probably won't be asked to implement them, it's still good to know that they exist, what operations they allow to perform, and what the runtime complexities of those operations are.