This file contains 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
vector<int> sumZero(int n) { | |
if (n == 0 || n == 1) return std::vector<int>(1, 0);; | |
std::vector<int> result; | |
for (int i = 1; i <= n/2; i++) { | |
result.push_back(i); | |
result.push_back(-i); | |
} | |
This file contains 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
diff --git a/drivers/gpu/drm/i915/intel_uncore.c b/drivers/gpu/drm/i915/intel_uncore.c | |
index 533d82bcef63..857c08709d84 100644 | |
--- a/drivers/gpu/drm/i915/intel_uncore.c | |
+++ b/drivers/gpu/drm/i915/intel_uncore.c | |
@@ -359,7 +359,7 @@ static void __gen6_gt_wait_for_fifo(struct intel_uncore *uncore) | |
if (wait_for_atomic((n = fifo_free_entries(uncore)) > | |
GT_FIFO_NUM_RESERVED_ENTRIES, | |
GT_FIFO_TIMEOUT_MS)) { | |
- drm_dbg_core(uncore->i915->drm, "GT_FIFO timeout, entries: %u\n", n) | |
+ drm_dbg_core(&uncore->i915->drm, "GT_FIFO timeout, entries: %u\n", n); |
This file contains 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
import sys | |
import logging | |
import os | |
from http.server import HTTPServer, BaseHTTPRequestHandler, SimpleHTTPRequestHandler | |
import socket | |
formatter = '[%(asctime)-15s] %(levelname)s [%(filename)s.%(funcName)s#L%(lineno)d] - %(message)s' | |
logging.basicConfig(level = logging.DEBUG, format = formatter) |
This file contains 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 "tree.h" | |
int main(){ | |
/* Create the tree as illustrated in thr | |
* program challenge description. | |
*/ | |
Tree *tree = new Tree('a'); | |
Node *temp_b = tree->create_child(tree->root, 'b'); |
This file contains 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
import requests | |
class ServerRequest: | |
def __init__(self, host, port): | |
self.address = '{}:{}'.format(host, port) | |
def _get(self, key): | |
request = '{0}/get?key={1}'.format(self.address, key) | |
response = requests.get(request) | |
if response.status_code == 200: |
This file contains 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 <stdio.h> | |
#define MAX 100 | |
void crackle_pop(){ | |
for (int i = 1; i <= MAX; i++) { | |
if (i % 15 == 0) { | |
printf("CracklePop!\n"); | |
} | |
else if (i % 3 == 0) { |
This file contains 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
# Implementation of a dequeue using a doubly linked list | |
# Supports insertion and deletion of elements at both sides using FIFO | |
from doubly_linked import DoublyLinked | |
class LinkedDequeue(DoublyLinked): | |
'''A dequeue class that inherits from the DoublyLinked class. | |
It uses the inherited functions and attributes to perform dequeue functions.''' | |
def __init__(self): | |
super().__init__() |