repo_name stringlengths 6 97 | path stringlengths 3 341 | text stringlengths 8 1.02M |
|---|---|---|
steventfan/CS14 | Week5/Tree.h | #ifndef __TREE_H
#define __TREE_H
#include "Node.h"
class Tree {
private:
Node *root;
public:
Tree( );
~Tree( );
void insert(const string &);
void preOrder( ) const;
void inOrder( ) const;
void postOrder( ) const;
void remove(const string &);
bool search (const string &) const;
private:
// Add a... |
steventfan/CS14 | Week8/HashTable.h | <filename>Week8/HashTable.h
#ifndef HASHTABLE_H
#define HASHTABLE_H
#include <string>
#include <list>
#include <iostream>
#include "WordEntry.h"
using namespace std;
class HashTable {
private:
list<WordEntry> *hashTable;
int size;
public:
HashTable(int);
~HashTable();
bool contains(const string &);
double ... |
steventfan/CS14 | Week2/IntList.h | <filename>Week2/IntList.h
#ifndef INTLIST_H
#define INTLIST_H
#include <iostream>
using namespace std;
struct IntNode
{
int data;
IntNode *prev;
IntNode *next;
IntNode(int data) : data(data), prev(0), next(0) {}
};
class IntList
{
private:
IntNode *dummyHead;
IntNode *dummyTail;
... |
steventfan/CS14 | Week3/WordLadder.h | #ifndef WORDLADDER_H
#define WORDLADDER_H
#include <string>
#include <list>
#include <stack>
#include <queue>
using namespace std;
class WordLadder {
private:
list<string> dict; //list of possible words in ladder
bool validateWords(const string &, const string &);
bool createWordLadder(con... |
steventfan/CS14 | Week1/Playlist.h | #ifndef PLAYLIST_H
#define PLAYLIST_H
#include <string>
using namespace std;
class PlaylistNode
{
private:
string uniqueID;
string songName;
string artistName;
int songLength;
PlaylistNode* nextNodePtr;
public:
PlaylistNode();
PlaylistNode(string, string... |
qichaotang97/ps-lite | include/dmlc/logging.h | <filename>include/dmlc/logging.h
/*!
* Copyright (c) 2015 by Contributors
* \file logging.h
* \brief defines logging macros of dmlc
* allows use of GLOG, fall back to internal
* implementation when disabled
*/
#ifndef DMLC_LOGGING_H_
#define DMLC_LOGGING_H_
#include <cstdio>
#include <cstdlib>
#include <... |
qichaotang97/ps-lite | include/ps/range.h | /**
* Copyright (c) 2015 by Contributors
*/
#ifndef PS_RANGE_H_
#define PS_RANGE_H_
#include "ps/internal/utils.h"
namespace ps {
/**
* \brief a range [begin, end)
*/
class Range {
public:
Range() : Range(0, 0) { }
Range(uint64_t begin, uint64_t end) : begin_(begin), end_(end) { }
uint64_t begin(... |
mystaff/crashpad | handler/relaunch_signal.h | <reponame>mystaff/crashpad
#ifndef CRASHPAD_HANDLER_RELAUNCH_SIGNAL_H_
#define CRASHPAD_HANDLER_RELAUNCH_SIGNAL_H_
#include <string>
#include <map>
namespace td {
void SetCrashed();
void RelaunchOnCrash(const std::map<std::string, std::string>& annotations);
}
#endif // CRASHPAD_HANDLER_RELAUNCH_SIGNAL_H_
|
ROCmSoftwarePlatform/aws-ofi-rccl | include/stack.h | /*
* Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All rights reserved.
* Modifications Copyright (c) 2021, Advanced Micro Devices, Inc. All rights reserved.
*/
#ifndef STACK_H_
#define STACK_H_
#ifdef _cplusplus
extern "C" {
#endif
#include "config.h"
#include <nccl_ofi.h>
#include <nccl_ofi_log.h>
#inc... |
ROCmSoftwarePlatform/aws-ofi-rccl | include/nccl_ofi.h | /*
* Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All rights reserved.
* Modifications Copyright (c) 2021, Advanced Micro Devices, Inc. All rights reserved.
*/
#ifndef NCCL_OFI_H_
#define NCCL_OFI_H_
#ifdef _cplusplus
extern "C" {
#endif
#include <stdbool.h>
#include <rdma/fabric.h>
#include <rdma/fi_er... |
taqu/VirtualCameraFilter | VCamFilter.h | <gh_stars>0
#pragma once
#ifndef INC_VCAM_FILTER_H_
# define INC_VCAM_FILTER_H_
// clang-format off
/*
# License
This software is distributed under two licenses, choose whichever you like.
## MIT License
Copyright (c) 2021 <NAME>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this... |
taqu/VirtualCameraFilter | VCamPipe.h | <reponame>taqu/VirtualCameraFilter<gh_stars>0
#pragma once
#ifndef INC_VCAM_PIPE_H_
# define INC_VCAM_PIPE_H_
// clang-format off
/*
# License
This software is distributed under two licenses, choose whichever you like.
## MIT License
Copyright (c) 2021 <NAME>
Permission is hereby granted, free of charge, to any p... |
ggramaize/repeater_utils-dev | ptt.h | /*
Copyright (c) 2016 <NAME>
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, ... |
bluecadet/Cinder-BluecadetProximity | src/Proximity.h | <filename>src/Proximity.h<gh_stars>1-10
#pragma once
#include "cinder/app/App.h"
#include "cinder/Serial.h"
namespace bluecadet {
namespace proximity {
typedef std::shared_ptr<class Proximity> ProximityRef;
class Proximity {
public:
struct Device {
cinder::SerialRef serial;
std::string name;
std::string path;... |
douban/python-libmemcached | split_mc.h | #ifndef SPLIT_MC_H
#define SPLIT_MC_H
#include "libmemcached/memcached.h"
#ifdef __cplusplus
extern "C" {
#endif
#define CHUNK_SIZE 1000000
#define FLAG_CHUNKED (1<<12)
memcached_return split_mc_set(struct memcached_st *mc, char *key, size_t key_len, void *val,
size_t bytes, time_t expire, uint32_t flags);
char*... |
douban/python-libmemcached | split_mc.c | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include "split_mc.h"
memcached_return split_mc_set(struct memcached_st *mc, char *key, size_t key_len, void *val,
size_t bytes, time_t expire, uint32_t flags)
{
char chunk_key[250];
int i;
memcached_return retval;
in... |
dsyomichev/rpi-ws281x-node | src/module.h | <gh_stars>0
#ifndef _MODULE_H_
#define _MODULE_H_
#define NAPI_VERSION 6
#include <math.h>
#include <node_api.h>
#include <pwm.h>
#include <stdio.h>
#include <string.h>
#include <ws2811.h>
typedef struct {
char *name;
int channel_arr_index;
} prop_data;
#include "driver.h"
ws2811_t ws2811;
napi_value make_m... |
dsyomichev/rpi-ws281x-node | src/driver.h | #ifndef _DRIVER_H_
#define _DRIVER_H_
#include "channel.h"
#include "module.h"
#include "rpi_hw.h"
#define DRIVER_PROPS 10
napi_ref driver_obj_ref;
napi_status init_driver_obj(napi_env env, napi_value *target);
napi_status free_driver_obj(napi_env env);
napi_property_descriptor make_render_wait_time_prop();
napi_v... |
dsyomichev/rpi-ws281x-node | src/rpi_hw.h | <filename>src/rpi_hw.h
#ifndef _RPI_HW_H_
#define _RPI_HW_H_
#include "module.h"
#define RPI_HW_PROPS 5
napi_ref rpi_hw_obj_ref;
napi_status init_rpi_hw_obj(napi_env env, napi_value *target);
napi_status free_rpi_hw_obj(napi_env env);
napi_property_descriptor make_rpi_hw_type_prop(napi_env env);
napi_value ... |
dsyomichev/rpi-ws281x-node | src/rpi_hw.c | <gh_stars>0
#include "rpi_hw.h"
napi_ref rpi_hw_obj_ref;
napi_status init_rpi_hw_obj(napi_env env, napi_value *target) {
napi_status status = napi_ok;
napi_property_descriptor prop[RPI_HW_PROPS];
if (ws2811.rpi_hw != NULL) {
status = napi_create_object(env, target);
if (status != napi_ok)... |
dsyomichev/rpi-ws281x-node | src/module.c | #include "module.h"
ws2811_t ws2811;
NAPI_MODULE(RPI_WS281X_NODE, make_module)
napi_value make_module(napi_env env, napi_value exports) {
napi_status status;
napi_value driver_obj;
status = init_driver_obj(env, &driver_obj);
if (status != napi_ok) {
throw_generic_error(env);
return NULL;
}
re... |
dsyomichev/rpi-ws281x-node | src/driver.c | #include "driver.h"
napi_ref driver_obj_ref;
napi_status init_driver_obj(napi_env env, napi_value *target) {
napi_status status;
napi_property_descriptor prop[DRIVER_PROPS];
napi_value rpi_hw_obj, channel_arr;
status = napi_create_object(env, target);
if (status != napi_ok) {
... |
dsyomichev/rpi-ws281x-node | src/channel.h | #ifndef _CHANNEL_H_
#define _CHANNEL_H_
#include "module.h"
#define CHANNEL_PROPS 11
#define GAMMA_TABLE_SIZE 256
napi_ref channel_arr_ref, channel_obj_ref[RPI_PWM_CHANNELS];
napi_status init_channel_arr(napi_env env, napi_value *target);
napi_status free_channel_arr(napi_env env);
napi_status init_channel_leds_ar... |
dsyomichev/rpi-ws281x-node | src/channel.c | #include "channel.h"
napi_ref channel_arr_ref, channel_obj_ref[RPI_PWM_CHANNELS];
napi_status init_channel_arr(napi_env env, napi_value *target) {
napi_status status;
int channel_arr_index;
status = napi_create_array_with_length(env, RPI_PWM_CHANNELS, target);
if (status != napi_ok) {
return sta... |
OpenGeoscience/vtkseasme | src/TraceHeaderBytesPositions.h | <reponame>OpenGeoscience/vtkseasme
/*=========================================================================
Program: Visualization Toolkit
Module: vtkPlane.h
Copyright (c) <NAME>, <NAME>, <NAME>
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This so... |
OpenGeoscience/vtkseasme | src/SegyTraceReader.h | <reponame>OpenGeoscience/vtkseasme<filename>src/SegyTraceReader.h<gh_stars>1-10
/*=========================================================================
Program: Visualization Toolkit
Module: vtkPlane.h
Copyright (c) <NAME>, <NAME>, <NAME>
All rights reserved.
See Copyright.txt or http://www.kitware... |
OpenGeoscience/vtkseasme | src/RdvReader.h | <reponame>OpenGeoscience/vtkseasme
/*=========================================================================
Program: Visualization Toolkit
Module: vtkPlane.h
Copyright (c) <NAME>, <NAME>, <NAME>
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This so... |
OpenGeoscience/vtkseasme | src/BinaryHeaderBytesPositions.h | /*=========================================================================
Program: Visualization Toolkit
Module: vtkPlane.h
Copyright (c) <NAME>, <NAME>, <NAME>
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY W... |
OpenGeoscience/vtkseasme | src/vtkSegy2DReader.h | <reponame>OpenGeoscience/vtkseasme
/*=========================================================================
Program: Visualization Toolkit
Module: vtkPlane.h
Copyright (c) <NAME>, <NAME>, <NAME>
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This so... |
OpenGeoscience/vtkseasme | src/IOUtil.h | <reponame>OpenGeoscience/vtkseasme<filename>src/IOUtil.h<gh_stars>1-10
/*=========================================================================
Program: Visualization Toolkit
Module: vtkPlane.h
Copyright (c) <NAME>, <NAME>, <NAME>
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copy... |
OpenGeoscience/vtkseasme | src/vtkSegy3DReader.h | /*=========================================================================
Program: Visualization Toolkit
Module: vtkPlane.h
Copyright (c) <NAME>, <NAME>, <NAME>
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY W... |
OpenGeoscience/vtkseasme | src/SegyReader.h | /*=========================================================================
Program: Visualization Toolkit
Module: vtkPlane.h
Copyright (c) <NAME>, <NAME>, <NAME>
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY W... |
OpenGeoscience/vtkseasme | src/vtkSeismicSliceCallback.h | /*=========================================================================
Program: Visualization Toolkit
Module: vtkPlane.h
Copyright (c) <NAME>, <NAME>, <NAME>
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY W... |
OpenGeoscience/vtkseasme | src/Trace.h | /*=========================================================================
Program: Visualization Toolkit
Module: vtkPlane.h
Copyright (c) <NAME>, <NAME>, <NAME>
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY W... |
OpenGeoscience/vtkseasme | src/vtkSeismicSliceWidget.h | <reponame>OpenGeoscience/vtkseasme<filename>src/vtkSeismicSliceWidget.h
/*=========================================================================
Program: Visualization Toolkit
Module: vtkPlane.h
Copyright (c) <NAME>, <NAME>, <NAME>
All rights reserved.
See Copyright.txt or http://www.kitware.com/Cop... |
banchichen/CaptivePortalCheck | CaptivePortalCheck/CaptivePortalCheck/CaptivePortalCheck.h | <filename>CaptivePortalCheck/CaptivePortalCheck/CaptivePortalCheck.h
//
// CaptivePortalCheck.h
// alishuju
//
// Created by 谭真 on 2017/8/30.
// Copyright © 2017年 Alibaba. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface CaptivePortalCheck : NSObject
+ (instancetype)sharedInstance;
/// 开启测试模式,开启后,每次验证... |
timo-cmd2/wake | sources/wake.c | <reponame>timo-cmd2/wake<gh_stars>0
#iclude <stdio.h>
|
4np/miniupnp | miniupnpd/miniupnpd.c | <reponame>4np/miniupnp<filename>miniupnpd/miniupnpd.c
/* $Id: miniupnpd.c,v 1.239 2019/10/05 20:21:47 nanard Exp $ */
/* vim: tabstop=4 shiftwidth=4 noexpandtab
* MiniUPnP project
* http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
* (c) 2006-2019 <NAME>
* This software is subject to the conditions detaile... |
4np/miniupnp | miniupnpd/portinuse.c | /* $Id: portinuse.c,v 1.9 2019/09/24 11:49:28 nanard Exp $ */
/* vim: tabstop=4 shiftwidth=4 noexpandtab
* MiniUPnP project
* (c) 2007-2019 <NAME>
* http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
* This software is subject to the conditions detailed
* in the LICENCE file provided within the distributio... |
ViperScience/rpg | src/c/tests/test_random.c | #include <stdio.h>
#include "rngs.h"
int main() {
PlantSeeds(-1); // -1 -> Use system time
FILE *fp;
fp = fopen("randomoutput.txt", "w");
if (fp != NULL)
for (int i = 0; i < 100000; ++i) {
printf("%f\n", Random());
fprintf(fp, "%f\n", Random());
}
fclose(fp);
... |
ViperScience/rpg | src/c/rpg.c | <reponame>ViperScience/rpg
// rpg.c
// Random Password Generator (RPG)
// This function provides capability for generating a stong random password.
// Copyright 2018 Viper Science LLC under the MIT license.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associ... |
Finding-Jeb/SpaceAppsChallenge | firmware/spaceApps/config _template.h | //Rename the file to config.h, and fill in the required information below
#define SSID_LOCAL "your_ssid"
#define WLAN_KEY "<PASSWORD>_wifi_password"
//Address of the http server running the web app with /data on the end
//IP should be shown when running http-server
#define LOCAL_SERVER "http://192.168.1.33:8080/data" |
feliposz/hackerrank-solutions | algorithms/greedy/jim-and-the-orders.c | #include <assert.h>
#include <ctype.h>
#include <limits.h>
#include <math.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
char* readline();
char* ltrim(char*);
char* rtrim(char*);
char** split_string(char*);
int parse_int(char*);
/*
* Comple... |
feliposz/hackerrank-solutions | data-structures/linked-lists/print-the-elements-of-a-linked-list-in-reverse.c | <reponame>feliposz/hackerrank-solutions<gh_stars>0
// Complete the reversePrint function below.
/*
* For your reference:
*
* SinglyLinkedListNode {
* int data;
* SinglyLinkedListNode* next;
* };
*
*/
void reversePrint(SinglyLinkedListNode* head) {
if (head) {
reversePrint(head->next);
... |
feliposz/hackerrank-solutions | data-structures/linked-lists/reverse-a-doubly-linked-list.c | <filename>data-structures/linked-lists/reverse-a-doubly-linked-list.c
// Complete the reverse function below.
/*
* For your reference:
*
* DoublyLinkedListNode {
* int data;
* DoublyLinkedListNode* next;
* DoublyLinkedListNode* prev;
* };
*
*/
DoublyLinkedListNode* reverse(DoublyLinkedListNode* ... |
feliposz/hackerrank-solutions | security/functions/security-function-ii.c | <gh_stars>0
/*
* Complete the function below.
*/
int function(int x) {
return x*x;
}
|
feliposz/hackerrank-solutions | algorithms/implementation/bon-appetit.c | #include <assert.h>
#include <ctype.h>
#include <limits.h>
#include <math.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
char* readline();
char* ltrim(char*);
char* rtrim(char*);
char** split_string(char*);
// Complete the bonAppetit function... |
feliposz/hackerrank-solutions | c/c-conditionals-and-loops/printing-pattern-2.c | #include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
int main()
{
int n;
scanf("%d", &n);
// Complete the code to print the pattern.
int i, j;
for (i = -n+1; i < n; i++) {
for (j = -n+1; j < n; j++) {
int ring = 1 + (abs(i) > abs(j) ? abs(i) : abs(j));
... |
feliposz/hackerrank-solutions | algorithms/implementation/between-two-sets.c | <reponame>feliposz/hackerrank-solutions<filename>algorithms/implementation/between-two-sets.c
#include <assert.h>
#include <ctype.h>
#include <limits.h>
#include <math.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
char* readline();
char* ltri... |
feliposz/hackerrank-solutions | c/c-functions/variadic-functions-in-c.c | <reponame>feliposz/hackerrank-solutions
int sum (int count,...) {
va_list vl;
va_start(vl, count);
int result;
for (int i = 0; i < count; i++) {
result += va_arg(vl, int);
}
va_end(vl);
return result;
}
int min(int count,...) {
if (count <= 0)
return 0;
va_list vl;
va_st... |
feliposz/hackerrank-solutions | data-structures/linked-lists/insert-a-node-at-the-head-of-a-linked-list.c |
// Complete the insertNodeAtHead function below.
/*
* For your reference:
*
* SinglyLinkedListNode {
* int data;
* SinglyLinkedListNode* next;
* };
*
*/
SinglyLinkedListNode* insertNodeAtHead(SinglyLinkedListNode* llist, int data) {
SinglyLinkedListNode *node = malloc(sizeof(SinglyLinkedListNode)... |
feliposz/hackerrank-solutions | data-structures/linked-lists/insert-a-node-into-a-sorted-doubly-linked-list.c |
// Complete the sortedInsert function below.
/*
* For your reference:
*
* DoublyLinkedListNode {
* int data;
* DoublyLinkedListNode* next;
* DoublyLinkedListNode* prev;
* };
*
*/
DoublyLinkedListNode* sortedInsert(DoublyLinkedListNode* head, int data) {
DoublyLinkedListNode *node = malloc(si... |
feliposz/hackerrank-solutions | security/functions/security-involution.c | <reponame>feliposz/hackerrank-solutions<gh_stars>0
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
int main() {
int n;
scanf("%d", &n);
int *perm = malloc(sizeof(int) * (n+1));
for (int i = 1; i <= n; i++) {
scanf("%d", &perm[i]);
}
int count = 0;
... |
feliposz/hackerrank-solutions | algorithms/implementation/breaking-best-and-worst-records.c | <filename>algorithms/implementation/breaking-best-and-worst-records.c
#include <assert.h>
#include <limits.h>
#include <math.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
char* readline();
char** split_string(char*);
// Complete the breaking... |
feliposz/hackerrank-solutions | data-structures/trees/tree-top-view.c |
/* you only have to complete the function given below.
node is defined as
struct node {
int data;
struct node *left;
struct node *right;
};
*/
void traverse(struct node *n, int hd, int depth, int *result, int *result_depth) {
if (n) {
if (depth < result_depth[250+hd]) {
... |
feliposz/hackerrank-solutions | data-structures/linked-lists/insert-a-node-at-the-tail-of-a-linked-list.c | <filename>data-structures/linked-lists/insert-a-node-at-the-tail-of-a-linked-list.c
// Complete the insertNodeAtTail function below.
/*
* For your reference:
*
* SinglyLinkedListNode {
* int data;
* SinglyLinkedListNode* next;
* };
*
*/
SinglyLinkedListNode* insertNodeAtTail(SinglyLinkedListNode* hea... |
feliposz/hackerrank-solutions | algorithms/implementation/magic-square-forming.c | <gh_stars>0
#include <assert.h>
#include <limits.h>
#include <math.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
char* readline();
char** split_string(char*);
int magic_squares[][3][3] = {
{{8, 1, 6}, {3, 5, 7}, {4, 9, 2}},
{{6, 1, 8... |
feliposz/hackerrank-solutions | c/c-functions/students-marks-sum.c | <reponame>feliposz/hackerrank-solutions<filename>c/c-functions/students-marks-sum.c
//Complete the following function.
int marks_summation(int* marks, int number_of_students, char gender) {
//Write your code here.
int i = (gender == 'b' ? 0 : 1), sum = 0;
for (; i < number_of_students; i += 2) {
sum += mar... |
feliposz/hackerrank-solutions | c/c-structs-and-enums/small-triangles-large-triangles.c | <filename>c/c-structs-and-enums/small-triangles-large-triangles.c
double volume_triangle(float a, float b, float c) {
double p = (a + b + c) / 2.0;
double s = sqrt(p * (p - a) * (p - b) * (p - c));
return s;
}
int cmp_triangle(const void *t1, const void *t2) {
triangle *tr1 = (triangle *)t1;
triangle *tr2 ... |
feliposz/hackerrank-solutions | algorithms/implementation/the-hurdle-race.c | <reponame>feliposz/hackerrank-solutions<filename>algorithms/implementation/the-hurdle-race.c
#include <assert.h>
#include <limits.h>
#include <math.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
char* readline();
char** split_string(char*);
/... |
feliposz/hackerrank-solutions | algorithms/implementation/circular-array-rotation.c | #include <assert.h>
#include <limits.h>
#include <math.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
char* readline();
char** split_string(char*);
// Complete the circularArrayRotation function below.
// Please store the size of the integer... |
feliposz/hackerrank-solutions | data-structures/linked-lists/find-the-merge-point-of-two-joined-linked-lists.c |
// Complete the findMergeNode function below.
/*
* For your reference:
*
* SinglyLinkedListNode {
* int data;
* SinglyLinkedListNode* next;
* };
*
*/
int findMergeNode(SinglyLinkedListNode* head1, SinglyLinkedListNode* head2) {
for (SinglyLinkedListNode *a = head1; a; a = a->next) {
for (... |
feliposz/hackerrank-solutions | algorithms/implementation/beautiful-days-at-the-movies.c | #include <assert.h>
#include <limits.h>
#include <math.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
char* readline();
char** split_string(char*);
int reverse(int n)
{
int result = 0;
while (n > 0)
{
result = result * 10... |
feliposz/hackerrank-solutions | data-structures/linked-lists/get-the-value-of-the-node-at-a-specific-position-from-the-tail.c | <reponame>feliposz/hackerrank-solutions
// Complete the getNode function below.
/*
* For your reference:
*
* SinglyLinkedListNode {
* int data;
* SinglyLinkedListNode* next;
* };
*
*/
int getNode(SinglyLinkedListNode* head, int positionFromTail) {
int size = 0;
for (SinglyLinkedListNode *p ... |
feliposz/hackerrank-solutions | data-structures/linked-lists/detect-whether-a-linked-list-contains-a-cycle.c | <reponame>feliposz/hackerrank-solutions
// Complete the has_cycle function below.
/*
* For your reference:
*
* SinglyLinkedListNode {
* int data;
* SinglyLinkedListNode* next;
* };
*
*/
bool has_cycle(SinglyLinkedListNode* head) {
SinglyLinkedListNode **visited = malloc(1000 * sizeof(SinglyLinked... |
feliposz/hackerrank-solutions | algorithms/implementation/permutation-equation.c | <gh_stars>0
#include <assert.h>
#include <limits.h>
#include <math.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
char* readline();
char** split_string(char*);
// Complete the permutationEquation function below.
// Please store the size of t... |
feliposz/hackerrank-solutions | algorithms/implementation/day-of-the-programmer.c | #include <assert.h>
#include <ctype.h>
#include <limits.h>
#include <math.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
char* readline();
char* ltrim(char*);
char* rtrim(char*);
// Complete the dayOfProgrammer function below.
/*
* To retur... |
feliposz/hackerrank-solutions | algorithms/implementation/3d-surface-area.c | <gh_stars>0
#include <assert.h>
#include <limits.h>
#include <math.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
char* readline();
char** split_string(char*);
// Complete the surfaceArea function below.
int surfaceArea(int A_rows, int A_colu... |
feliposz/hackerrank-solutions | algorithms/greedy/grid-challenge.c | #include <assert.h>
#include <limits.h>
#include <math.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
char* readline();
// Complete the gridChallenge function below.
// Please either make the string static or allocate on the heap. For exampl... |
feliposz/hackerrank-solutions | data-structures/linked-lists/reverse-a-linked-list.c | <reponame>feliposz/hackerrank-solutions<gh_stars>0
// Complete the reverse function below.
/*
* For your reference:
*
* SinglyLinkedListNode {
* int data;
* SinglyLinkedListNode* next;
* };
*
*/
SinglyLinkedListNode* revHelper(SinglyLinkedListNode* curr, SinglyLinkedListNode *prev) {
SinglyLinke... |
feliposz/hackerrank-solutions | data-structures/linked-lists/delete-a-node-from-a-linked-list.c |
// Complete the deleteNode function below.
/*
* For your reference:
*
* SinglyLinkedListNode {
* int data;
* SinglyLinkedListNode* next;
* };
*
*/
SinglyLinkedListNode* deleteNode(SinglyLinkedListNode* head, int position) {
if (position == 0) {
return head->next;
} else {
Sin... |
feliposz/hackerrank-solutions | data-structures/arrays/crush.c | #include <assert.h>
#include <limits.h>
#include <math.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
char* readline();
char** split_string(char*);
// Complete the arrayManipulation function below.
long arrayManipulation(int n, int queries_ro... |
feliposz/hackerrank-solutions | data-structures/linked-lists/compare-two-linked-lists.c |
// Complete the compare_lists function below.
/*
* For your reference:
*
* SinglyLinkedListNode {
* int data;
* SinglyLinkedListNode* next;
* };
*
*/
bool compare_lists(SinglyLinkedListNode* head1, SinglyLinkedListNode* head2) {
if ((head1 == NULL) && (head2 == NULL))
{
return true;
... |
feliposz/hackerrank-solutions | algorithms/strings/strong-password.c | #include <assert.h>
#include <ctype.h>
#include <limits.h>
#include <math.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
char* readline();
char* ltrim(char*);
char* rtrim(char*);
int parse_int(char*);
/*
* Complete the 'minimumNumber' funct... |
feliposz/hackerrank-solutions | data-structures/linked-lists/insert-a-node-at-a-specific-position-in-a-linked-list.c | <reponame>feliposz/hackerrank-solutions
// Complete the insertNodeAtPosition function below.
/*
* For your reference:
*
* SinglyLinkedListNode {
* int data;
* SinglyLinkedListNode* next;
* };
*
*/
SinglyLinkedListNode* insertNodeAtPosition(SinglyLinkedListNode* head, int data, int position) {
Sin... |
feliposz/hackerrank-solutions | c/c-functions/permutations-of-strings.c | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
int next_permutation(int n, char **s) {
// Find the largest index k such that s[k] < s[k + 1]
int k = -1;
for (int i = 0; i < n - 1; i++) {
if (strcmp(s[i], s[i + 1]) < 0) {
k = i;
}
}
// If no such index exists, the permutation is th... |
feliposz/hackerrank-solutions | algorithms/implementation/cut-the-sticks.c | <gh_stars>0
#include <assert.h>
#include <limits.h>
#include <math.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
char* readline();
char** split_string(char*);
// Complete the cutTheSticks function below.
// Please store the size of the inte... |
feliposz/hackerrank-solutions | c/c-arrays-and-strings/dynamic-array-in-c.c |
int main()
{
int total_number_of_shelves;
scanf("%d", &total_number_of_shelves);
int total_number_of_queries;
scanf("%d", &total_number_of_queries);
total_number_of_books = (int *) calloc(total_number_of_shelves, sizeof(int));
total_number_of_pages = (int **) calloc(total_number_of_shelv... |
feliposz/hackerrank-solutions | algorithms/implementation/electronics-shop.c | #include <assert.h>
#include <limits.h>
#include <math.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
char* readline();
char** split_string(char*);
/*
* Complete the getMoneySpent function below.
*/
int getMoneySpent(int keyboards_count, int* keyboards, int drives_count, int* dri... |
feliposz/hackerrank-solutions | algorithms/greedy/priyanka-and-toys.c | #include <assert.h>
#include <limits.h>
#include <math.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
char* readline();
char** split_string(char*);
int cmp(const void *a, const void *b) {
return *(int *)a - *(int *)b;
}
// Complete the t... |
feliposz/hackerrank-solutions | c/c-functions/sorting-array-of-strings.c |
int lexicographic_sort(const char* a, const char* b) {
return strcmp(a, b);
}
int lexicographic_sort_reverse(const char* a, const char* b) {
return strcmp(b, a);
}
int count_distinct(const char *s) {
int c[256] = {0};
while (*s) {
c[*s] = 1;
s++;
}
int distinct = 0;
for (int... |
feliposz/hackerrank-solutions | c/c-introduction/pointer-in-c.c | #include <stdio.h>
void update(int *a,int *b) {
int sum = *a + *b;
int dif = *a - *b;
if (dif < 0) dif = -dif;
*a = sum;
*b = dif;
}
int main() {
int a, b;
int *pa = &a, *pb = &b;
scanf("%d %d", &a, &b);
update(pa, pb);
printf("%d\n%d", a, b);
return 0;
}
|
feliposz/hackerrank-solutions | c/c-conditionals-and-loops/conditional-statements-in-c.c | <reponame>feliposz/hackerrank-solutions<filename>c/c-conditionals-and-loops/conditional-statements-in-c.c
#include <assert.h>
#include <limits.h>
#include <math.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
char* readline();
int main()
{
... |
feliposz/hackerrank-solutions | mathematics/fundamentals/find-point.c | <filename>mathematics/fundamentals/find-point.c
#include <assert.h>
#include <limits.h>
#include <math.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
char* readline();
char** split_string(char*);
/*
* Complete the findPoint function below.
*/
/*
* Please store the size of the i... |
feliposz/hackerrank-solutions | data-structures/linked-lists/print-the-elements-of-a-linked-list.c | <filename>data-structures/linked-lists/print-the-elements-of-a-linked-list.c
// Complete the printLinkedList function below.
/*
* For your reference:
*
* SinglyLinkedListNode {
* int data;
* SinglyLinkedListNode* next;
* };
*
*/
void printLinkedList(SinglyLinkedListNode* head) {
for (SinglyLinked... |
feliposz/hackerrank-solutions | algorithms/implementation/save-the-prisoner.c | <reponame>feliposz/hackerrank-solutions
#include <assert.h>
#include <limits.h>
#include <math.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
char* readline();
char** split_string(char*);
// Complete the saveThePrisoner function below.
int sa... |
feliposz/hackerrank-solutions | c/c-arrays-and-strings/frequency-of-digits-1.c | <filename>c/c-arrays-and-strings/frequency-of-digits-1.c
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
int main() {
/* Enter your code here. Read input from STDIN. Print output to STDOUT */
char s[1000];
scanf("%[^\n]%*c", s);
int dig[10] = {0};
int i = 0;
i... |
feliposz/hackerrank-solutions | algorithms/strings/separate-the-numbers.c | <reponame>feliposz/hackerrank-solutions
#include <assert.h>
#include <ctype.h>
#include <limits.h>
#include <math.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
char* readline();
char* ltrim(char*);
char* rtrim(char*);
int parse_int(char*);
... |
feliposz/hackerrank-solutions | algorithms/implementation/almost-sorted.c | #include <assert.h>
#include <ctype.h>
#include <limits.h>
#include <math.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
char* readline();
char* ltrim(char*);
char* rtrim(char*);
char** split_string(char*);
int parse_int(char*);
/*
* Comple... |
feliposz/hackerrank-solutions | c/c-structs-and-enums/structuring-the-document.c |
struct document get_document(char *text) {
struct document doc = {NULL, 0};
int pi = 0;
while (*text) {
int pi = doc.paragraph_count++;
doc.data = (struct paragraph *)realloc(doc.data, sizeof(struct paragraph) *
doc.paragraph_count);
doc.data[... |
feliposz/hackerrank-solutions | c/c-conditionals-and-loops/bitwise-operators-in-c.c | #include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
//Complete the following function.
void calculate_the_maximum(int n, int k) {
//Write your code here.
}
int main() {
int n, k;
scanf("%d %d", &n, &k);
calculate_the_maximum(n, k);
int a, b, max_and = 0, max_or = 0, max... |
feliposz/hackerrank-solutions | security/functions/security-tutorial-permutations.c | #include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
int main() {
int n;
scanf("%d", &n);
int *perm = malloc(sizeof(int) * n);
for (int i = 1; i <= n; i++) {
scanf("%d", &perm[i-1]);
}
for (int i = 0; i < n; i++) {
printf("%d\n", perm[perm[i]-1]);
... |
feliposz/hackerrank-solutions | data-structures/trees/tree-level-order-traversal.c | <gh_stars>0
/* you only have to complete the function given below.
node is defined as
struct node {
int data;
struct node *left;
struct node *right;
};
*/
int treeHeight(struct node *root) {
if (root) {
int left = treeHeight(root->left);
int right = treeHeight(root->right... |
feliposz/hackerrank-solutions | data-structures/linked-lists/merge-two-sorted-linked-lists.c | <gh_stars>0
// Complete the mergeLists function below.
/*
* For your reference:
*
* SinglyLinkedListNode {
* int data;
* SinglyLinkedListNode* next;
* };
*
*/
SinglyLinkedListNode* mergeLists(SinglyLinkedListNode* head1, SinglyLinkedListNode* head2) {
SinglyLinkedListNode* head = head1;
... |
feliposz/hackerrank-solutions | algorithms/arrays-and-sorting/correctness-invariant.c | <gh_stars>0
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#include <assert.h>
void checkSort(int N, int arr[]) {
for (int i = 1; i < N; i++) {
if (arr[i-1] > arr[i]) {
fprintf(stderr, "not ok %d\n", N);
return;
}
}
fprintf(stderr, "ok %... |
feliposz/hackerrank-solutions | algorithms/implementation/the-birthday-bar.c | <reponame>feliposz/hackerrank-solutions
#include <assert.h>
#include <ctype.h>
#include <limits.h>
#include <math.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
char* readline();
char* ltrim(char*);
char* rtrim(char*);
char** split_string(char... |
feliposz/hackerrank-solutions | algorithms/implementation/append-and-delete.c | #include <assert.h>
#include <limits.h>
#include <math.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
char* readline();
// Complete the appendAndDelete function below.
// Please either make the string static or allocate on the heap. For exam... |
feliposz/hackerrank-solutions | data-structures/linked-lists/delete-duplicate-value-nodes-from-a-sorted-linked-list.c | <reponame>feliposz/hackerrank-solutions
// Complete the removeDuplicates function below.
/*
* For your reference:
*
* SinglyLinkedListNode {
* int data;
* SinglyLinkedListNode* next;
* };
*
*/
SinglyLinkedListNode* removeDuplicates(SinglyLinkedListNode* head) {
if (head && head->next) {
i... |
feliposz/hackerrank-solutions | algorithms/strings/making-anagrams.c | <filename>algorithms/strings/making-anagrams.c
#include <assert.h>
#include <ctype.h>
#include <limits.h>
#include <math.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
char* readline();
/*
* Complete the 'makingAnagrams' function below.
*
... |
feliposz/hackerrank-solutions | algorithms/implementation/queens-attack-2.c | <reponame>feliposz/hackerrank-solutions
#include <assert.h>
#include <limits.h>
#include <math.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
char* readline();
char** split_string(char*);
int min(int a, int b) {
return a < b ? a : b;
}
i... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.