We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Structuring the Document
Structuring the Document
Sort by
recency
|
131 Discussions
|
Please Login in order to post a comment
struct document Doc = {0};
void initialise_document(char *text){
char text_buffer[MAX_CHARACTERS]; strcpy(text_buffer, text); int p_count = 0;
// for each paragraph sentence count
}
struct document get_document(char* text) {
}
struct word kth_word_in_mth_sentence_of_nth_paragraph(struct document Doc, int k, int m, int n) {
}
struct sentence kth_sentence_in_mth_paragraph(struct document Doc, int k, int m) { if (k < 1 || k > Doc.paragraph_count) { printf("Paragraph index out of bounds\n"); exit(1); }
}
struct paragraph kth_paragraph(struct document Doc, int k) { if(k >= 1 || k <= Doc.paragraph_count){ return Doc.data[k-1]; } else{ printf("k is out of bound"); exit(1); } }
When accessing the k-th/m-th/n-th element, all the test cases are off by one. The arrays are indexed from 1 to n instead of the usual 0 to n-1. This discrepancy caused the problem to take me over 24 hours to solve, whereas it should have taken around 90 to 120 minutes. Detail explaination: https://priceindanger.fr/
When calling the kth/mth/nth element everything in the test cases is off by one. Instead of going from 0:n-1 the arrays go from 1:n. This made the problem take >24 hours instead of 90:120 minutes for me to solve.
on you code I find one mistake here is the updated code visit: https://priceindanger.com/
Here is Structuring the Document solution in c - https://programmingoneonone.com/hackerrank-structuring-the-document-solution-in-c.html