Skip to content
Permalink
Browse files

More reformatting and fixes

  • Loading branch information...
metopa committed May 3, 2018
1 parent 7fada56 commit 53ab74829299b34e0361dbe89bac14992caff17a
Showing 564 changed files with 1,132 additions and 2,520 deletions.
@@ -1,8 +1,6 @@
#include <vector>
#include "test_framework/generic_test.h"

using std::vector;

vector<double> GenerateFirstKABSqrt2(int k) {
// TODO - you fill in here.
return {};
@@ -1,9 +1,7 @@
#include <stdexcept>
#include <vector>

#include "test_framework/generic_test.h"
#include "test_framework/test_failure.h"

using std::invalid_argument;
using std::vector;

@@ -12,7 +10,6 @@ int FindMissingElement(vector<int>::const_iterator stream_begin,
// TODO - you fill in here.
return 0;
}

int FindMissingElementWrapper(const vector<int>& stream) {
try {
return FindMissingElement(cbegin(stream), cend(stream));
@@ -1,9 +1,7 @@
#include <string>

#include "test_framework/fmt_print.h"
#include "test_framework/generic_test.h"
#include "test_framework/test_failure.h"

using std::string;

class ClientsCreditsInfo {
@@ -12,28 +10,23 @@ class ClientsCreditsInfo {
// TODO - you fill in here.
return;
}

bool Remove(const string& client_id) {
// TODO - you fill in here.
return true;
}

int Lookup(const string& client_id) const {
// TODO - you fill in here.
return 0;
}

void AddAll(int C) {
// TODO - you fill in here.
return;
}

string Max() const {
// TODO - you fill in here.
return "";
}
};

struct Operation {
std::string op;
std::string s_arg;
@@ -1,8 +1,6 @@
#include <vector>
#include "test_framework/generic_test.h"

using std::vector;

bool CanReachEnd(const vector<int>& max_advance_steps) {
// TODO - you fill in here.
return true;
@@ -1,18 +1,14 @@
#include <string>
#include <vector>

#include "test_framework/fmt_print.h"
#include "test_framework/generic_test.h"
#include "test_framework/test_failure.h"
#include "test_framework/timed_executor.h"

using std::vector;

void Rearrange(vector<int>* A_ptr) {
// TODO - you fill in here.
return;
}

void CheckAnswer(const vector<int>& A) {
for (int i = 0; i < A.size(); ++i) {
if (i % 2) {
@@ -1,7 +1,6 @@
#include <string>
#include <vector>
#include "test_framework/generic_test.h"

using std::string;
using std::vector;

@@ -1,13 +1,10 @@
#include <vector>
#include "test_framework/generic_test.h"

using std::vector;

void ApplyPermutation(vector<int>* perm_ptr, vector<int>* A_ptr) {
// TODO - you fill in here.
return;
}

vector<int> ApplyPermutationWrapper(vector<int> perm, vector<int> A) {
ApplyPermutation(&perm, &A);
return A;
@@ -1,6 +1,5 @@
#include <vector>
#include "test_framework/generic_test.h"

using std::vector;

bool IsArbitrageExist(vector<vector<double>> graph) {
@@ -1,22 +1,27 @@

#pragma once

#include <list>
#include <memory>
#include <random>

#include "test_framework/binary_tree_utils.h"
#include "test_framework/serialization_traits.h"

#pragma once

using std::unique_ptr;


template <typename T>
struct BinaryTreeNode {
T data;
unique_ptr<BinaryTreeNode<T>> left, right;

explicit BinaryTreeNode(const T& data) : data(data) {}
BinaryTreeNode(T data, unique_ptr<BinaryTreeNode<T>> left,
unique_ptr<BinaryTreeNode<T>> right)
: data(data), left(std::move(left)), right(std::move(right)) {}

};


DECLARE_BINARY_TREE_TYPE(KeyT, std::unique_ptr<BinaryTreeNode<KeyT>>, false)
@@ -1,18 +1,23 @@

#pragma once

#include <memory>

#include "test_framework/binary_tree_utils.h"
#include "test_framework/serialization_traits.h"

#pragma once

using std::unique_ptr;


template <typename T>
struct BinaryTreeNode {
T data;
unique_ptr<BinaryTreeNode<T>> left, right;
BinaryTreeNode<T>* parent;

explicit BinaryTreeNode(const T& data) : data(data), parent(nullptr) {}

};


DECLARE_BINARY_TREE_TYPE(KeyT, std::unique_ptr<BinaryTreeNode<KeyT>>, true)
@@ -1,6 +1,5 @@
#include <vector>
#include "test_framework/generic_test.h"

using std::vector;

int CalculateBonus(const vector<int>& productivity) {
@@ -1,8 +1,6 @@
#include <memory>

#include "bst_node.h"
#include "test_framework/generic_test.h"

using std::unique_ptr;
using std::vector;

@@ -1,12 +1,10 @@
#include <memory>
#include <vector>

#include "bst_node.h"
#include "test_framework/binary_tree_utils.h"
#include "test_framework/generic_test.h"
#include "test_framework/test_failure.h"
#include "test_framework/timed_executor.h"

using std::unique_ptr;
using std::vector;

@@ -15,7 +13,6 @@ unique_ptr<BstNode<int>> BuildMinHeightBSTFromSortedArray(
// TODO - you fill in here.
return nullptr;
}

int BuildMinHeightBSTFromSortedArrayWrapper(TimedExecutor& executor,
const vector<int>& A) {
unique_ptr<BstNode<int>> result =
@@ -1,8 +1,6 @@
#include <memory>

#include "bst_prototype_shared_ptr.h"
#include "test_framework/generic_test.h"

using std::shared_ptr;

shared_ptr<BstNode<int>> MergeTwoBSTs(shared_ptr<BstNode<int>> A,
@@ -1,20 +1,25 @@

#pragma once

#include <memory>

#include "test_framework/binary_tree_utils.h"
#include "test_framework/serialization_traits.h"

#pragma once

using std::unique_ptr;


template <typename T>
struct BstNode {
T data;
unique_ptr<BstNode<T>> left, right;

explicit BstNode(const T& data) : data(data) {}

BstNode(T data, unique_ptr<BstNode<T>> left, unique_ptr<BstNode<T>> right)
: data(data), left(std::move(left)), right(std::move(right)) {}

};


DECLARE_BINARY_TREE_TYPE(KeyT, std::unique_ptr<BstNode<KeyT>>, false)
@@ -1,17 +1,22 @@

#pragma once

#include <memory>

#include "test_framework/binary_tree_utils.h"
#include "test_framework/serialization_traits.h"

#pragma once

using std::shared_ptr;


template <typename T>
struct BstNode {
T data;
shared_ptr<BstNode<T>> left, right;

explicit BstNode(const T& data) : data(data) {}

};


DECLARE_BINARY_TREE_TYPE(KeyT, std::shared_ptr<BstNode<KeyT>>, false)
@@ -1,19 +1,15 @@
#include <memory>
#include <vector>

#include "bst_prototype_shared_ptr.h"
#include "test_framework/generic_test.h"
#include "test_framework/test_failure.h"
#include "test_framework/timed_executor.h"

using std::shared_ptr;

shared_ptr<BstNode<int>> BSTToDoublyLinkedList(
const shared_ptr<BstNode<int>>& tree) {
// TODO - you fill in here.
return nullptr;
}

std::vector<int> BSTToDoublyLinkedListWrapper(
TimedExecutor& executor, const std::shared_ptr<BstNode<int>>& tree) {
auto list = executor.Run([&] { return BSTToDoublyLinkedList(tree); });
@@ -1,8 +1,6 @@
#include <vector>
#include "test_framework/generic_test.h"

using std::vector;

double BuyAndSellStockOnce(const vector<double>& prices) {
// TODO - you fill in here.
return 0.0;
@@ -1,6 +1,5 @@
#include <vector>
#include "test_framework/generic_test.h"

using std::vector;

double BuyAndSellStockKTimes(const vector<double>& prices, int k) {
@@ -1,8 +1,6 @@
#include <vector>
#include "test_framework/generic_test.h"

using std::vector;

double BuyAndSellStockTwice(const vector<double>& prices) {
// TODO - you fill in here.
return 0.0;
@@ -1,19 +1,15 @@
#include <vector>

#include "test_framework/generic_test.h"
#include "test_framework/serialization_traits.h"

using std::vector;

struct Event {
int start, finish;
};

int FindMaxSimultaneousEvents(const vector<Event>& A) {
// TODO - you fill in here.
return 0;
}

template <>
struct SerializationTraits<Event> : UserSerTraits<Event, int, int> {};

@@ -1,28 +1,22 @@

#include "test_framework/generic_test.h"
#include "test_framework/serialization_traits.h"
#include "test_framework/test_failure.h"

class Queue {
public:
Queue(size_t capacity) {}

void Enqueue(int x) {
// TODO - you fill in here.
return;
}

int Dequeue() {
// TODO - you fill in here.
return 0;
}

int Size() const {
// TODO - you fill in here.
return 0;
}
};

struct QueueOp {
enum { kConstruct, kDequeue, kEnqueue, kSize } op;
int argument;
@@ -1,5 +1,4 @@
#include "test_framework/generic_test.h"

unsigned long long ClosestIntSameBitCount(unsigned long long x) {
// TODO - you fill in here.
return 0;
@@ -1,6 +1,5 @@
#include <vector>
#include "test_framework/generic_test.h"

using std::vector;

bool TestCollatzConjecture(int n) {
@@ -1,6 +1,5 @@
#include <vector>
#include "test_framework/generic_test.h"

using std::vector;

vector<vector<int>> Combinations(int n, int k) {
Oops, something went wrong.

0 comments on commit 53ab748

Please sign in to comment.
You can’t perform that action at this time.