# 11315 - Reverse Linked List ## 題解: 視作為push front來建立一個linked list就好了 ## Code: ```cpp #include "function.h" #include <stdio.h> #include <stdlib.h> Node* createReversedList(){ int val; Node* head = NULL; while(1){ scanf("%d", &val); if(val == -1) break; // create new node Node* new_node = (Node*)malloc(sizeof(Node)); new_node->data = val; // push front new_node->next = head; head = new_node; } return head; } ``` ###### tags: `NTHUOJ`
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up